README
¶
github.com/gobuffalo/pop/nulls
DEPRECATED: use github.com/gobuffalo/nulls instead.
This package should be used in place of the built-in null types in the sql
package.
The real benefit of this packages comes in its implementation of MarshalJSON
and UnmarshalJSON
to properly encode/decode null
values.
Installation
$ go get github.com/gobuffalo/pop/nulls
Supported Datatypes
string
(nulls.String
) - Replacessql.NullString
int64
(nulls.Int64
) - Replacessql.NullInt64
float64
(nulls.Float64
) - Replacessql.NullFloat64
bool
(nulls.Bool
) - Replacessql.NullBool
[]byte
(nulls.ByteSlice
)float32
(nulls.Float32
)int
(nulls.Int
)int32
(nulls.Int32
)uint32
(nulls.UInt32
)time.Time
(nulls.Time
)
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NewBool = nulls.NewBool
NewBool returns a new, properly instantiated Bool object.
var NewByteSlice = nulls.NewByteSlice
NewByteSlice returns a new, properly instantiated ByteSlice object.
var NewFloat32 = nulls.NewFloat32
NewFloat32 returns a new, properly instantiated Float32 object.
var NewFloat64 = nulls.NewFloat64
NewFloat64 returns a new, properly instantiated Float64 object.
var NewInt = nulls.NewInt
NewInt returns a new, properly instantiated Int object.
var NewInt32 = nulls.NewInt32
NewInt32 returns a new, properly instantiated Int object.
var NewInt64 = nulls.NewInt64
NewInt64 returns a new, properly instantiated Int64 object.
var NewString = nulls.NewString
NewString returns a new, properly instantiated String object.
var NewTime = nulls.NewTime
NewTime returns a new, properly instantiated Time object.
var NewUInt32 = nulls.NewUInt32
NewUInt32 returns a new, properly instantiated Int object.
var NewUUID = nulls.NewUUID
NewUUID returns a new, properly instantiated UUID object.
var RegisterWithSchema = nulls.RegisterWithSchema
RegisterWithSchema allows for the nulls package to be used with http://www.gorillatoolkit.org/pkg/schema#Converter
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool replaces sql.NullBool with an implementation that supports proper JSON encoding/decoding.
type ByteSlice ¶
ByteSlice adds an implementation for []byte that supports proper JSON encoding/decoding.
type Float32 ¶
Float32 adds an implementation for float32 that supports proper JSON encoding/decoding.
type Float64 ¶
Float64 replaces sql.NullFloat64 with an implementation that supports proper JSON encoding/decoding.
type Int64 ¶
Int64 replaces sql.Int64 with an implementation that supports proper JSON encoding/decoding.
type Nulls ¶
type Nulls struct {
Value interface{}
}
Nulls a generic nulls type. something that implements nullable interface. can be any of nulls.Int, nulls.uuid.UUID nulls.String, etc.
func New ¶
func New(i interface{}) *Nulls
New returns a wrapper called nulls for the interface passed as a param.
type String ¶
String replaces sql.NullString with an implementation that supports proper JSON encoding/decoding.
type Time ¶
Time replaces sql.NullTime with an implementation that supports proper JSON encoding/decoding.