Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // NoType values are null.Type constants for convenience and readability NoBool Bool = Bool{Valid: false} NoString String = String{Valid: false} NoFloat Float = Float{Valid: false} NoInt Int = Int{Valid: false} NoTime Time = Time{Valid: false} NoDate Date = Date{Valid: false} NoUUID UUID = UUID{Valid: false} NoVersion Version = Version{Valid: false} )
var JsonNull = []byte("null")
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool is a nullable boolean that doesn't require an extra allocation or dereference. The builting sql package has a NullBool, but it doesn't implement json.Marshaler.
func (Bool) MarshalJSON ¶
Implement json.Marshaler interface
func (*Bool) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type Date ¶
Date is a nullable date.Date that doesn't require an extra allocation or dereference. It supports encoding/decoding with database/sql, encoding/gob, and encoding/json.
func (Date) MarshalJSON ¶
Implement json.Marshaler interface
func (*Date) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type Float ¶
Float is a nullable float64 that doesn't require an extra allocation or dereference. The builting sql package has a NullFloat64, but it doesn't implement json.Marshaler.
func (Float) MarshalJSON ¶
Implement json.Marshaler interface
func (*Float) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type Int ¶
Int is a nullable int that doesn't require an extra allocation or dereference. The builting sql package has a NullInt64, but it doesn't implement json.Marshaler and is an int64 instead of an int.
func (Int) MarshalJSON ¶
Implement json.Marshaler interface
func (*Int) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type String ¶
type String sql.NullString
String is a nullable string that doesn't require an extra allocation or dereference. The builting sql package has a NullString, but it doesn't implement json.Marshaler.
func SomeString ¶
func (String) MarshalJSON ¶
Implement json.Marshaler interface
func (*String) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type Time ¶
Time is a nullable time.Time that doesn't require an extra allocation or dereference. It supports encoding/decoding with database/sql, encoding/gob, and encoding/json.
func (Time) MarshalJSON ¶
Implement json.Marshaler interface
func (*Time) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type UUID ¶
type UUID struct { UUID uuid.UUID Valid bool }
UUID is a nullable uuid.UUID that doesn't require an extra allocation or dereference. It supports encoding/decoding with database/sql, encoding/gob, and encoding/json.
func (UUID) MarshalJSON ¶
Implement json.Marshaler interface
func (*UUID) UnmarshalJSON ¶
Implement json.Unmarshaler interface
type Version ¶
Version is a nullable semver.Version that doesn't require an extra allocation or dereference. It supports encoding/decoding with database/sql, encoding/gob, and encoding/json.
func SomeVersion ¶
func (Version) MarshalJSON ¶
Implement json.Marshaler interface
func (*Version) UnmarshalJSON ¶
Implement json.Unmarshaler interface