Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool is a nullable bool. It does not consider false values to be null. It will decode to null, not false, if null.
func (Bool) IsZero ¶
IsZero returns true for invalid Bools, for future omitempty support (Go 1.4?). A non-null Bool with a 0 value will not be considered zero.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Bool. It also supports unmarshalling a sql.NullBool.
type Int ¶
Int is an nullable int64. It does not consider zero values to be null. It will decode to null, not zero, if null.
func (Int) IsZero ¶
IsZero returns true for invalid Ints, for future omitempty support (Go 1.4?). A non-null Int with a 0 value will not be considered zero.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int. It also supports unmarshalling a sql.NullInt64.
type String ¶
type String struct {
sql.NullString
}
String is a nullable string. It supports SQL and JSON serialization. It will marshal to null if null. Blank string input will be considered null.
func (String) IsZero ¶
IsZero returns true for null strings, for potential future omitempty support.
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It supports string and null input. Blank string input does not produce a null String. It also supports unmarshalling a sql.NullString.
type Time ¶ added in v1.14.1
Time is a nullable time.Time. JSON marshals to the zero value for time.Time if null. Considered to be null to SQL if zero.
func (Time) IsZero ¶ added in v1.14.1
IsZero returns true for null or zero Times, for potential future omitempty support.
func (Time) MarshalJSON ¶ added in v1.14.1
MarshalJSON implements json.Marshaler. It will encode null if this time is null.
func (Time) Ptr ¶ added in v1.16.0
Ptr returns a pointer to this Time's value, or a nil pointer if this Time is zero.
func (*Time) UnmarshalJSON ¶ added in v1.14.1
UnmarshalJSON implements json.Unmarshaler. It supports string, object (e.g. pq.NullTime and friends) and null input.
func (Time) ValueOrZero ¶ added in v1.14.1
ValueOrZero returns the inner value if valid, otherwise zero.