diff --git a/README.md b/README.md index 9abdb1c..3601a2f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -## null [![GoDoc](https://godoc.org/github.com/guregu/null?status.svg)](https://godoc.org/github.com/guregu/null) [![Coverage](http://gocover.io/_badge/github.com/guregu/null)](http://gocover.io/github.com/guregu/null) -`import "gopkg.in/guregu/null.v3"` +## null-extended [![GoDoc](https://godoc.org/github.com/nullbio/null?status.svg)](https://godoc.org/github.com/nullbio/null) [![Coverage](http://gocover.io/_badge/github.com/nullbio/null)](http://gocover.io/github.com/nullbio/null) +`import "gopkg.in/nullbio/null.v4"` null is a library with reasonable options for dealing with nullable SQL and JSON values @@ -9,11 +9,11 @@ Types in `null` will only be considered null on null input, and will JSON encode Types in `zero` are treated like zero values in Go: blank string input will produce a null `zero.String`, and null Strings will JSON encode to `""`. Zero values of these types will be considered null to SQL. If you need zero and null treated the same, use these. -All types implement `sql.Scanner` and `driver.Valuer`, so you can use this library in place of `sql.NullXXX`. All types also implement: `encoding.TextMarshaler`, `encoding.TextUnmarshaler`, `json.Marshaler`, and `json.Unmarshaler`. +All types implement `sql.Scanner` and `driver.Valuer`, so you can use this library in place of `sql.NullXXX`. All types also implement: `encoding.TextMarshaler`, `encoding.TextUnmarshaler`, `json.Marshaler`, `json.Unmarshaler` and `sql.Scanner`. ### null package -`import "gopkg.in/guregu/null.v3"` +`import "gopkg.in/nullbio/null.v4"` #### null.String Nullable string. @@ -91,7 +91,7 @@ Marshals to JSON null if SQL source data is null. Zero input will not produce a ### zero package -`import "gopkg.in/guregu/null.v3/zero"` +`import "gopkg.in/nullbio/null.v4/zero"` #### zero.String Nullable string. diff --git a/float32.go b/float32.go index b374639..e073999 100644 --- a/float32.go +++ b/float32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullFloat32 is a replica of sql.NullFloat64 for float32 types. @@ -142,5 +142,5 @@ func (n NullFloat32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Float32, nil + return float64(n.Float32), nil } diff --git a/int.go b/int.go index 67078b3..1cca607 100644 --- a/int.go +++ b/int.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullInt is a replica of sql.NullInt64 for int types. @@ -143,5 +143,5 @@ func (n NullInt) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int, nil + return int64(n.Int), nil } diff --git a/int16.go b/int16.go index cb8bd62..a19ac82 100644 --- a/int16.go +++ b/int16.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullInt16 is a replica of sql.NullInt64 for int16 types. @@ -143,5 +143,5 @@ func (n NullInt16) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int16, nil + return int64(n.Int16), nil } diff --git a/int32.go b/int32.go index 5e82e2c..de55e3c 100644 --- a/int32.go +++ b/int32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullInt32 is a replica of sql.NullInt64 for int32 types. @@ -143,5 +143,5 @@ func (n NullInt32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int32, nil + return int64(n.Int32), nil } diff --git a/int8.go b/int8.go index 319be8a..b8fde00 100644 --- a/int8.go +++ b/int8.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullInt8 is a replica of sql.NullInt64 for int8 types. @@ -143,5 +143,5 @@ func (n NullInt8) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int8, nil + return int64(n.Int8), nil } diff --git a/uint.go b/uint.go index 7d6dc8f..46f8282 100644 --- a/uint.go +++ b/uint.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint is a replica of sql.NullInt64 for uint types. @@ -143,5 +143,5 @@ func (n NullUint) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint, nil + return int64(n.Uint), nil } diff --git a/uint16.go b/uint16.go index 35e8286..c8b9848 100644 --- a/uint16.go +++ b/uint16.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint16 is a replica of sql.NullInt64 for uint16 types. @@ -143,5 +143,5 @@ func (n NullUint16) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint16, nil + return int64(n.Uint16), nil } diff --git a/uint32.go b/uint32.go index 15aa80b..3d6034f 100644 --- a/uint32.go +++ b/uint32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint32 is a replica of sql.NullInt64 for uint32 types. @@ -143,5 +143,5 @@ func (n NullUint32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint32, nil + return int64(n.Uint32), nil } diff --git a/uint64.go b/uint64.go index de4f791..b46324a 100644 --- a/uint64.go +++ b/uint64.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint64 is a replica of sql.NullInt64 for uint64 types. @@ -143,5 +143,5 @@ func (n NullUint64) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint64, nil + return int64(n.Uint64), nil } diff --git a/uint8.go b/uint8.go index 0add4b5..95e2c0c 100644 --- a/uint8.go +++ b/uint8.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint8 is a replica of sql.NullInt64 for uint8 types. @@ -143,5 +143,5 @@ func (n NullUint8) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint8, nil + return int64(n.Uint8), nil } diff --git a/zero/float32.go b/zero/float32.go index 9d9c8a8..81da838 100644 --- a/zero/float32.go +++ b/zero/float32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullFloat32 struct { @@ -140,5 +140,5 @@ func (n NullFloat32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Float32, nil + return float64(n.Float32), nil } diff --git a/zero/int.go b/zero/int.go index d707616..e496fa7 100644 --- a/zero/int.go +++ b/zero/int.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullInt struct { @@ -142,5 +142,5 @@ func (n NullInt) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int, nil + return int64(n.Int), nil } diff --git a/zero/int16.go b/zero/int16.go index 3fab63f..43bb546 100644 --- a/zero/int16.go +++ b/zero/int16.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullInt16 struct { @@ -142,5 +142,5 @@ func (n NullInt16) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int16, nil + return int64(n.Int16), nil } diff --git a/zero/int32.go b/zero/int32.go index ac0ce62..db5bc86 100644 --- a/zero/int32.go +++ b/zero/int32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullInt32 struct { @@ -142,5 +142,5 @@ func (n NullInt32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int32, nil + return int64(n.Int32), nil } diff --git a/zero/int8.go b/zero/int8.go index 05178ee..ffeccf7 100644 --- a/zero/int8.go +++ b/zero/int8.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullInt8 struct { @@ -142,5 +142,5 @@ func (n NullInt8) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Int8, nil + return int64(n.Int8), nil } diff --git a/zero/uint.go b/zero/uint.go index f90e919..7a1f2bb 100644 --- a/zero/uint.go +++ b/zero/uint.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullUint struct { @@ -142,5 +142,5 @@ func (n NullUint) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint, nil + return int64(n.Uint), nil } diff --git a/zero/uint16.go b/zero/uint16.go index 32d2072..974f505 100644 --- a/zero/uint16.go +++ b/zero/uint16.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullUint16 struct { @@ -142,5 +142,5 @@ func (n NullUint16) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint16, nil + return int64(n.Uint16), nil } diff --git a/zero/uint32.go b/zero/uint32.go index 7112282..ff4002e 100644 --- a/zero/uint32.go +++ b/zero/uint32.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullUint32 struct { @@ -142,5 +142,5 @@ func (n NullUint32) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint32, nil + return int64(n.Uint32), nil } diff --git a/zero/uint64.go b/zero/uint64.go index 53917e4..699bfc5 100644 --- a/zero/uint64.go +++ b/zero/uint64.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) // NullUint64 is a replica of sql.NullInt64 for uint64 types. @@ -142,5 +142,5 @@ func (n NullUint64) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint64, nil + return int64(n.Uint64), nil } diff --git a/zero/uint8.go b/zero/uint8.go index 5d8f81a..6dc96f0 100644 --- a/zero/uint8.go +++ b/zero/uint8.go @@ -7,7 +7,7 @@ import ( "reflect" "strconv" - "github.com/pobri19/null-extended/convert" + "gopkg.in/nullbio/null.v4/convert" ) type NullUint8 struct { @@ -142,5 +142,5 @@ func (n NullUint8) Value() (driver.Value, error) { if !n.Valid { return nil, nil } - return n.Uint8, nil + return int64(n.Uint8), nil }