Fix README, fix Valuer methods

* Fix import paths
This commit is contained in:
Patrick O'brien 2016-06-08 13:53:02 +10:00
parent 4f91fe41ce
commit 67ba4e0272
21 changed files with 45 additions and 45 deletions

View file

@ -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) ## 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/guregu/null.v3"` `import "gopkg.in/nullbio/null.v4"`
null is a library with reasonable options for dealing with nullable SQL and JSON values 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. 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 ### null package
`import "gopkg.in/guregu/null.v3"` `import "gopkg.in/nullbio/null.v4"`
#### null.String #### null.String
Nullable 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 ### zero package
`import "gopkg.in/guregu/null.v3/zero"` `import "gopkg.in/nullbio/null.v4/zero"`
#### zero.String #### zero.String
Nullable string. Nullable string.

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullFloat32 is a replica of sql.NullFloat64 for float32 types. // NullFloat32 is a replica of sql.NullFloat64 for float32 types.
@ -142,5 +142,5 @@ func (n NullFloat32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Float32, nil return float64(n.Float32), nil
} }

4
int.go
View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullInt is a replica of sql.NullInt64 for int types. // NullInt is a replica of sql.NullInt64 for int types.
@ -143,5 +143,5 @@ func (n NullInt) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int, nil return int64(n.Int), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullInt16 is a replica of sql.NullInt64 for int16 types. // NullInt16 is a replica of sql.NullInt64 for int16 types.
@ -143,5 +143,5 @@ func (n NullInt16) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int16, nil return int64(n.Int16), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullInt32 is a replica of sql.NullInt64 for int32 types. // NullInt32 is a replica of sql.NullInt64 for int32 types.
@ -143,5 +143,5 @@ func (n NullInt32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int32, nil return int64(n.Int32), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullInt8 is a replica of sql.NullInt64 for int8 types. // NullInt8 is a replica of sql.NullInt64 for int8 types.
@ -143,5 +143,5 @@ func (n NullInt8) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int8, nil return int64(n.Int8), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint is a replica of sql.NullInt64 for uint types. // NullUint is a replica of sql.NullInt64 for uint types.
@ -143,5 +143,5 @@ func (n NullUint) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint, nil return int64(n.Uint), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint16 is a replica of sql.NullInt64 for uint16 types. // NullUint16 is a replica of sql.NullInt64 for uint16 types.
@ -143,5 +143,5 @@ func (n NullUint16) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint16, nil return int64(n.Uint16), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint32 is a replica of sql.NullInt64 for uint32 types. // NullUint32 is a replica of sql.NullInt64 for uint32 types.
@ -143,5 +143,5 @@ func (n NullUint32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint32, nil return int64(n.Uint32), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint64 is a replica of sql.NullInt64 for uint64 types. // NullUint64 is a replica of sql.NullInt64 for uint64 types.
@ -143,5 +143,5 @@ func (n NullUint64) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint64, nil return int64(n.Uint64), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint8 is a replica of sql.NullInt64 for uint8 types. // NullUint8 is a replica of sql.NullInt64 for uint8 types.
@ -143,5 +143,5 @@ func (n NullUint8) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint8, nil return int64(n.Uint8), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullFloat32 struct { type NullFloat32 struct {
@ -140,5 +140,5 @@ func (n NullFloat32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Float32, nil return float64(n.Float32), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullInt struct { type NullInt struct {
@ -142,5 +142,5 @@ func (n NullInt) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int, nil return int64(n.Int), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullInt16 struct { type NullInt16 struct {
@ -142,5 +142,5 @@ func (n NullInt16) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int16, nil return int64(n.Int16), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullInt32 struct { type NullInt32 struct {
@ -142,5 +142,5 @@ func (n NullInt32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int32, nil return int64(n.Int32), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullInt8 struct { type NullInt8 struct {
@ -142,5 +142,5 @@ func (n NullInt8) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Int8, nil return int64(n.Int8), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullUint struct { type NullUint struct {
@ -142,5 +142,5 @@ func (n NullUint) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint, nil return int64(n.Uint), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullUint16 struct { type NullUint16 struct {
@ -142,5 +142,5 @@ func (n NullUint16) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint16, nil return int64(n.Uint16), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullUint32 struct { type NullUint32 struct {
@ -142,5 +142,5 @@ func (n NullUint32) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint32, nil return int64(n.Uint32), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
// NullUint64 is a replica of sql.NullInt64 for uint64 types. // NullUint64 is a replica of sql.NullInt64 for uint64 types.
@ -142,5 +142,5 @@ func (n NullUint64) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint64, nil return int64(n.Uint64), nil
} }

View file

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"strconv" "strconv"
"github.com/pobri19/null-extended/convert" "gopkg.in/nullbio/null.v4/convert"
) )
type NullUint8 struct { type NullUint8 struct {
@ -142,5 +142,5 @@ func (n NullUint8) Value() (driver.Value, error) {
if !n.Valid { if !n.Valid {
return nil, nil return nil, nil
} }
return n.Uint8, nil return int64(n.Uint8), nil
} }