Documentation ¶
Index ¶
- func RegisterWithSchema(reg register)
- type Bool
- type ByteSlice
- func (ns ByteSlice) Interface() interface{}
- func (ns ByteSlice) MarshalJSON() ([]byte, error)
- func (ns *ByteSlice) Scan(value interface{}) error
- func (ns *ByteSlice) UnmarshalJSON(text []byte) error
- func (ns *ByteSlice) UnmarshalText(text []byte) error
- func (ns ByteSlice) Value() (driver.Value, error)
- type Float32
- type Float64
- type Int
- type Int32
- type Int64
- type Nulls
- type String
- type Time
- type UInt32
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterWithSchema ¶
func RegisterWithSchema(reg register)
RegisterWithSchema allows for the nulls package to be used with http://www.gorillatoolkit.org/pkg/schema#Converter
Types ¶
type Bool ¶
Bool replaces sql.NullBool with an implementation that supports proper JSON encoding/decoding.
func (Bool) Interface ¶
func (ns Bool) Interface() interface{}
Interface implements the nullable interface. It returns nil if the bool is not valid, otherwise it returns the bool value.
func (Bool) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the proper representation of that value. The strings "true" and "t" will be considered "true", "false" and "f" will be treated as "false". All other values will be set to null by Valid = false
func (*Bool) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type ByteSlice ¶
ByteSlice adds an implementation for []byte that supports proper JSON encoding/decoding.
func NewByteSlice ¶
NewByteSlice returns a new, properly instantiated ByteSlice object.
func (ByteSlice) Interface ¶
func (ns ByteSlice) Interface() interface{}
Interface implements the nullable interface. It returns nil if the byte slice is not valid, otherwise it returns the byte slice value.
func (ByteSlice) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*ByteSlice) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*ByteSlice) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Float32 ¶
Float32 adds an implementation for float32 that supports proper JSON encoding/decoding.
func NewFloat32 ¶
NewFloat32 returns a new, properly instantiated Float32 object.
func (Float32) Interface ¶
func (ns Float32) Interface() interface{}
Interface implements the nullable interface. It returns nil if the float32 is not valid, otherwise it returns the float32 value.
func (Float32) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Float32) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Float32) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Float64 ¶
type Float64 sql.NullFloat64
Float64 replaces sql.NullFloat64 with an implementation that supports proper JSON encoding/decoding.
func NewFloat64 ¶
NewFloat64 returns a new, properly instantiated Float64 object.
func (Float64) Interface ¶
func (ns Float64) Interface() interface{}
Interface implements the nullable interface. It returns nil if the float64 is not valid, otherwise it returns the float64 value.
func (Float64) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Float64) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Int ¶
Int adds an implementation for int that supports proper JSON encoding/decoding.
func (Int) Interface ¶
func (ns Int) Interface() interface{}
Interface implements the nullable interface. It returns nil if the int is not valid, otherwise it returns the int value.
func (Int) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Int) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Int32 ¶
Int32 adds an implementation for int32 that supports proper JSON encoding/decoding.
func (Int32) Interface ¶
func (ns Int32) Interface() interface{}
Interface implements the nullable interface. It returns nil if the int32 is not valid, otherwise it returns the int32 value.
func (Int32) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Int32) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Int32) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Int64 ¶
Int64 replaces sql.Int64 with an implementation that supports proper JSON encoding/decoding.
func (Int64) Interface ¶
func (ns Int64) Interface() interface{}
Interface implements the nullable interface. It returns nil if the int64 is not valid, otherwise it returns the int64 value.
func (Int64) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Int64) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
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 ¶
type String sql.NullString
String replaces sql.NullString with an implementation that supports proper JSON encoding/decoding.
func (String) Interface ¶
func (ns String) Interface() interface{}
Interface implements the nullable interface. It returns nil if the string is not valid, otherwise it returns the string value.
func (String) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*String) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*String) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type Time ¶
Time replaces sql.NullTime with an implementation that supports proper JSON encoding/decoding.
func (Time) Interface ¶
func (ns Time) Interface() interface{}
Interface implements the nullable interface. It returns nil if the Time is not valid, otherwise it returns the Time value.
func (Time) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*Time) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type UInt32 ¶
UInt32 adds an implementation for int that supports proper JSON encoding/decoding.
func (UInt32) Interface ¶
func (ns UInt32) Interface() interface{}
Interface implements the nullable interface. It returns nil if the uint32 is not valid, otherwise it returns the uint32 value.
func (UInt32) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*UInt32) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*UInt32) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.
type UUID ¶
UUID can be used with the standard sql package to represent a UUID value that can be NULL in the database
func (UUID) Interface ¶
func (u UUID) Interface() interface{}
Interface implements the nullable interface. It returns nil if the UUID is not valid, otherwise it returns the UUID value.
func (UUID) MarshalJSON ¶
MarshalJSON marshals the underlying value to a proper JSON representation.
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON will unmarshal a JSON value into the propert representation of that value.
func (*UUID) UnmarshalText ¶
UnmarshalText will unmarshal text value into the propert representation of that value.