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)
`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.

View file

@ -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
}

4
int.go
View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}