Documentation ¶
Index ¶
- Constants
- Variables
- type Bool
- func (b Bool) IsSet() bool
- func (b Bool) IsValid() bool
- func (b Bool) IsZero() bool
- func (b Bool) MarshalJSON() ([]byte, error)
- func (b Bool) MarshalText() ([]byte, error)
- func (b Bool) Ptr() *bool
- func (t Bool) Result() string
- func (b *Bool) Scan(value any) error
- func (b *Bool) SetValid(v bool)
- func (b *Bool) UnmarshalJSON(data []byte) error
- func (b *Bool) UnmarshalText(text []byte) error
- func (b Bool) Value() (driver.Value, error)
- func (t Bool) ValueOrDefault() bool
- type Byte
- func (b Byte) IsSet() bool
- func (b Byte) IsValid() bool
- func (b Byte) IsZero() bool
- func (b Byte) MarshalJSON() ([]byte, error)
- func (b Byte) MarshalText() ([]byte, error)
- func (b Byte) Ptr() *byte
- func (t Byte) Result() string
- func (b *Byte) Scan(value any) error
- func (b *Byte) SetValid(n byte)
- func (b *Byte) UnmarshalJSON(data []byte) error
- func (b *Byte) UnmarshalText(text []byte) error
- func (b Byte) Value() (driver.Value, error)
- func (t Byte) ValueOrDefault() byte
- type Bytes
- func (b Bytes) IsSet() bool
- func (b Bytes) IsValid() bool
- func (b Bytes) IsZero() bool
- func (b Bytes) MarshalJSON() ([]byte, error)
- func (b Bytes) MarshalText() ([]byte, error)
- func (b Bytes) Ptr() *[]byte
- func (t Bytes) Result() string
- func (b *Bytes) Scan(value any) error
- func (b *Bytes) SetValid(n []byte)
- func (b *Bytes) UnmarshalJSON(data []byte) error
- func (b *Bytes) UnmarshalText(text []byte) error
- func (b Bytes) Value() (driver.Value, error)
- func (t Bytes) ValueOrDefault() []byte
- type CTime
- func (t CTime) IsSet() bool
- func (t CTime) IsValid() bool
- func (t CTime) IsZero() bool
- func (t CTime) MarshalJSON() ([]byte, error)
- func (t CTime) MarshalText() ([]byte, error)
- func (t CTime) Ptr() *time.Time
- func (t CTime) Result() string
- func (t *CTime) Scan(value any) error
- func (t *CTime) SetValid(v time.Time)
- func (t *CTime) UnmarshalJSON(data []byte) error
- func (t *CTime) UnmarshalText(text []byte) error
- func (t CTime) Value() (driver.Value, error)
- func (t CTime) ValueOrDefault() time.Time
- type Date
- func (t Date) IsSet() bool
- func (t Date) IsValid() bool
- func (t Date) IsZero() bool
- func (t Date) MarshalJSON() ([]byte, error)
- func (t Date) MarshalText() ([]byte, error)
- func (t Date) Ptr() *time.Time
- func (t Date) Result() string
- func (t *Date) Scan(value any) error
- func (t *Date) SetValid(v time.Time)
- func (t *Date) UnmarshalJSON(data []byte) error
- func (t *Date) UnmarshalText(text []byte) error
- func (t Date) Value() (driver.Value, error)
- func (t Date) ValueOrDefault() time.Time
- type DateTime
- func (t DateTime) IsSet() bool
- func (t DateTime) IsValid() bool
- func (t DateTime) IsZero() bool
- func (t DateTime) MarshalJSON() ([]byte, error)
- func (t DateTime) MarshalText() ([]byte, error)
- func (t DateTime) Ptr() *time.Time
- func (t DateTime) Result() string
- func (t *DateTime) Scan(value any) error
- func (t *DateTime) SetValid(v time.Time)
- func (t *DateTime) UnmarshalJSON(data []byte) error
- func (t *DateTime) UnmarshalText(text []byte) error
- func (t DateTime) Value() (driver.Value, error)
- func (t DateTime) ValueOrDefault() time.Time
- type Float32
- func (f Float32) IsSet() bool
- func (f Float32) IsValid() bool
- func (f Float32) IsZero() bool
- func (f Float32) MarshalJSON() ([]byte, error)
- func (f Float32) MarshalText() ([]byte, error)
- func (f Float32) Ptr() *float32
- func (a Float32) Result() string
- func (f *Float32) Scan(value any) error
- func (f *Float32) SetValid(n float32)
- func (f *Float32) UnmarshalJSON(data []byte) error
- func (f *Float32) UnmarshalText(text []byte) error
- func (f Float32) Value() (driver.Value, error)
- func (t Float32) ValueOrDefault() float32
- type Float64
- func (f Float64) IsSet() bool
- func (f Float64) IsValid() bool
- func (f Float64) IsZero() bool
- func (f Float64) MarshalJSON() ([]byte, error)
- func (f Float64) MarshalText() ([]byte, error)
- func (f Float64) Ptr() *float64
- func (a Float64) Result() string
- func (f *Float64) Scan(value any) error
- func (f *Float64) SetValid(n float64)
- func (f *Float64) UnmarshalJSON(data []byte) error
- func (f *Float64) UnmarshalText(text []byte) error
- func (f Float64) Value() (driver.Value, error)
- func (t Float64) ValueOrDefault() float64
- type Int
- func (i Int) IsSet() bool
- func (i Int) IsValid() bool
- func (i Int) IsZero() bool
- func (i Int) MarshalJSON() ([]byte, error)
- func (i Int) MarshalText() ([]byte, error)
- func (i Int) Ptr() *int
- func (a Int) Result() string
- func (i *Int) Scan(value any) error
- func (i *Int) SetValid(n int)
- func (i *Int) UnmarshalJSON(data []byte) error
- func (i *Int) UnmarshalText(text []byte) error
- func (i Int) Value() (driver.Value, error)
- func (i Int) ValueOrDefault() int
- type Int16
- func (i Int16) IsSet() bool
- func (i Int16) IsValid() bool
- func (i Int16) IsZero() bool
- func (i Int16) MarshalJSON() ([]byte, error)
- func (i Int16) MarshalText() ([]byte, error)
- func (i Int16) Ptr() *int16
- func (a Int16) Result() string
- func (i *Int16) Scan(value any) error
- func (i *Int16) SetValid(n int16)
- func (i *Int16) UnmarshalJSON(data []byte) error
- func (i *Int16) UnmarshalText(text []byte) error
- func (i Int16) Value() (driver.Value, error)
- func (i Int16) ValueOrDefault() int16
- type Int32
- func (i Int32) IsSet() bool
- func (i Int32) IsValid() bool
- func (i Int32) IsZero() bool
- func (i Int32) MarshalJSON() ([]byte, error)
- func (i Int32) MarshalText() ([]byte, error)
- func (i Int32) Ptr() *int32
- func (a Int32) Result() string
- func (i *Int32) Scan(value any) error
- func (i *Int32) SetValid(n int32)
- func (i *Int32) UnmarshalJSON(data []byte) error
- func (i *Int32) UnmarshalText(text []byte) error
- func (i Int32) Value() (driver.Value, error)
- func (i Int32) ValueOrDefault() int32
- type Int64
- func (i Int64) IsSet() bool
- func (i Int64) IsValid() bool
- func (i Int64) IsZero() bool
- func (i Int64) MarshalJSON() ([]byte, error)
- func (i Int64) MarshalText() ([]byte, error)
- func (i Int64) Ptr() *int64
- func (a Int64) Result() string
- func (i *Int64) Scan(value any) error
- func (i *Int64) SetValid(n int64)
- func (i *Int64) UnmarshalJSON(data []byte) error
- func (i *Int64) UnmarshalText(text []byte) error
- func (i Int64) Value() (driver.Value, error)
- func (i Int64) ValueOrDefault() int64
- type Int8
- func (i Int8) IsSet() bool
- func (i Int8) IsValid() bool
- func (i Int8) IsZero() bool
- func (i Int8) MarshalJSON() ([]byte, error)
- func (i Int8) MarshalText() ([]byte, error)
- func (i Int8) Ptr() *int8
- func (a Int8) Result() string
- func (i *Int8) Scan(value any) error
- func (i *Int8) SetValid(n int8)
- func (i *Int8) UnmarshalJSON(data []byte) error
- func (i *Int8) UnmarshalText(text []byte) error
- func (i Int8) Value() (driver.Value, error)
- func (i Int8) ValueOrDefault() int8
- type JSON
- func (j JSON) IsSet() bool
- func (j JSON) IsValid() bool
- func (j JSON) IsZero() bool
- func (j *JSON) Marshal(obj any) error
- func (j JSON) MarshalJSON() ([]byte, error)
- func (j JSON) MarshalText() ([]byte, error)
- func (j JSON) Ptr() *[]byte
- func (t JSON) Result() string
- func (j *JSON) Scan(value any) error
- func (j *JSON) SetValid(n []byte)
- func (j JSON) Unmarshal(dest any) error
- func (j *JSON) UnmarshalJSON(data []byte) error
- func (j *JSON) UnmarshalText(text []byte) error
- func (j JSON) Value() (driver.Value, error)
- func (t JSON) ValueOrDefault() []byte
- type String
- func (s String) IsSet() bool
- func (s String) IsValid() bool
- func (s String) IsZero() bool
- func (s String) MarshalJSON() ([]byte, error)
- func (s String) MarshalText() ([]byte, error)
- func (s String) Ptr() *string
- func (t String) Result() string
- func (s *String) Scan(value any) error
- func (s *String) SetValid(v string)
- func (s *String) UnmarshalJSON(data []byte) error
- func (s *String) UnmarshalText(text []byte) error
- func (s String) Value() (driver.Value, error)
- func (t String) ValueOrDefault() string
- type Time
- func (t Time) IsSet() bool
- func (t Time) IsValid() bool
- func (t Time) IsZero() bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) MarshalText() ([]byte, error)
- func (t Time) Ptr() *time.Time
- func (t Time) Result() string
- func (t *Time) Scan(value any) error
- func (t *Time) SetValid(v time.Time)
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t *Time) UnmarshalText(text []byte) error
- func (t Time) Value() (driver.Value, error)
- func (t Time) ValueOrDefault() time.Time
- type TimeStamp
- func (t TimeStamp) IsSet() bool
- func (t TimeStamp) IsValid() bool
- func (t TimeStamp) IsZero() bool
- func (t TimeStamp) MarshalJSON() ([]byte, error)
- func (t TimeStamp) MarshalText() ([]byte, error)
- func (t TimeStamp) Ptr() *time.Time
- func (t TimeStamp) Result() string
- func (t *TimeStamp) Scan(value any) error
- func (t *TimeStamp) SetValid(v time.Time)
- func (t *TimeStamp) UnmarshalJSON(data []byte) error
- func (t *TimeStamp) UnmarshalText(text []byte) error
- func (t TimeStamp) Value() (driver.Value, error)
- func (t TimeStamp) ValueOrDefault() time.Time
- type Uint
- func (u Uint) IsSet() bool
- func (u Uint) IsValid() bool
- func (u Uint) IsZero() bool
- func (u Uint) MarshalJSON() ([]byte, error)
- func (u Uint) MarshalText() ([]byte, error)
- func (u Uint) Ptr() *uint
- func (t Uint) Result() string
- func (u *Uint) Scan(value any) error
- func (u *Uint) SetValid(n uint)
- func (u *Uint) UnmarshalJSON(data []byte) error
- func (u *Uint) UnmarshalText(text []byte) error
- func (u Uint) Value() (driver.Value, error)
- func (u Uint) ValueOrDefault() uint
- type Uint16
- func (u Uint16) IsSet() bool
- func (u Uint16) IsValid() bool
- func (u Uint16) IsZero() bool
- func (u Uint16) MarshalJSON() ([]byte, error)
- func (u Uint16) MarshalText() ([]byte, error)
- func (u Uint16) Ptr() *uint16
- func (t Uint16) Result() string
- func (u *Uint16) Scan(value any) error
- func (u *Uint16) SetValid(n uint16)
- func (u *Uint16) UnmarshalJSON(data []byte) error
- func (u *Uint16) UnmarshalText(text []byte) error
- func (u Uint16) Value() (driver.Value, error)
- func (u Uint16) ValueOrDefault() uint16
- type Uint32
- func (u Uint32) IsSet() bool
- func (u Uint32) IsValid() bool
- func (u Uint32) IsZero() bool
- func (u Uint32) MarshalJSON() ([]byte, error)
- func (u Uint32) MarshalText() ([]byte, error)
- func (u Uint32) Ptr() *uint32
- func (t Uint32) Result() string
- func (u *Uint32) Scan(value any) error
- func (u *Uint32) SetValid(n uint32)
- func (u *Uint32) UnmarshalJSON(data []byte) error
- func (u *Uint32) UnmarshalText(text []byte) error
- func (u Uint32) Value() (driver.Value, error)
- func (u Uint32) ValueOrDefault() uint32
- type Uint64
- func (u Uint64) IsSet() bool
- func (u Uint64) IsValid() bool
- func (u Uint64) IsZero() bool
- func (u Uint64) MarshalJSON() ([]byte, error)
- func (u Uint64) MarshalText() ([]byte, error)
- func (u Uint64) Ptr() *uint64
- func (t Uint64) Result() string
- func (u *Uint64) Scan(value any) error
- func (u *Uint64) SetValid(n uint64)
- func (u *Uint64) UnmarshalJSON(data []byte) error
- func (u *Uint64) UnmarshalText(text []byte) error
- func (u Uint64) Value() (driver.Value, error)
- func (u Uint64) ValueOrDefault() uint64
- type Uint8
- func (u Uint8) IsSet() bool
- func (u Uint8) IsValid() bool
- func (u Uint8) IsZero() bool
- func (u Uint8) MarshalJSON() ([]byte, error)
- func (u Uint8) MarshalText() ([]byte, error)
- func (u Uint8) Ptr() *uint8
- func (t Uint8) Result() string
- func (u *Uint8) Scan(value any) error
- func (u *Uint8) SetValid(n uint8)
- func (u *Uint8) UnmarshalJSON(data []byte) error
- func (u *Uint8) UnmarshalText(text []byte) error
- func (u Uint8) Value() (driver.Value, error)
- func (u Uint8) ValueOrDefault() uint8
- type Value
Constants ¶
const ( RFC3339DateOnly = "2006-01-02" RFC3339TimeOnly = "15:04:05" DateTimeSQL = "2006-01-02 15:04:05" TimeStampSQL = "2006-01-02 15:04:05.000000" )
Variables ¶
var NullBytes = []byte("null")
NullBytes is a global byte slice of JSON null
Functions ¶
This section is empty.
Types ¶
type Bool ¶
Bool is a nullable bool.
func BoolFromPtr ¶
BoolFromPtr creates a new Bool that will be null if f is nil.
func (Bool) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Bool) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Bool) Ptr ¶
Ptr returns a pointer to this Bool's value, or a nil pointer if this Bool is null.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bool) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Bool) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Byte ¶
Byte is an nullable int.
func ByteFromPtr ¶
ByteFromPtr creates a new Byte that be null if i is nil.
func (Byte) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Byte) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Byte) Ptr ¶
Ptr returns a pointer to this Byte's value, or a nil pointer if this Byte is null.
func (*Byte) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Byte) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Byte) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Bytes ¶
Bytes is a nullable []byte.
func BytesFromPtr ¶
BytesFromPtr creates a new Bytes that will be invalid if nil.
func (Bytes) IsZero ¶
IsZero returns true for null or zero Bytes's, for future omitempty support (Go 1.4?)
func (Bytes) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Bytes) Ptr ¶
Ptr returns a pointer to this Bytes's value, or a nil pointer if this Bytes is null.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Bytes) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type CTime ¶
CTime (Customize Time) is a nullable time.Time that accept only hour,minutes,seconds and ignore elses. When it is serialize to JSON and vice versa only accept of front half RFC 3339 ([2 digit hour]:[2 digit minutes]:[2 digit seconds]). It supports SQL and JSON serialization.
func CTimeFromPtr ¶
CTimeFromPtr creates a new CTime that will be null if t is nil.
func NewCTime ¶
NewCTime creates a new Time. that accept only hour,minutes,seconds and ignore elses.
func (CTime) IsZero ¶
IsZero returns true for an invalid Time's value, for potential future omitempty support.
func (CTime) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (CTime) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (CTime) Ptr ¶
Ptr returns a pointer to this Time's value that accept only hour,minutes,seconds and ignore elses. , or a nil pointer if this Time is null.
func (*CTime) Scan ¶
Scan implements the Scanner interface. that accept only hour,minutes,seconds and ignore elses.
func (*CTime) SetValid ¶
SetValid changes this Time's value that accept only hour,minutes,seconds and ignore elses. and sets it to be non-null.
func (*CTime) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*CTime) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (CTime) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Date ¶
Date is a nullable time.Time that accept only fullyear,month,date and ignore elses. When it is serialize to JSON and vice versa only accept of front half RFC 3339 ([4 digit year]-[2 digit month]-[2 digit year]). It supports SQL and JSON serialization.
func DateFromPtr ¶
DateFromPtr creates a new Date that will be null if t is nil.
func (Date) IsZero ¶
IsZero returns true for an invalid Time's value, for potential future omitempty support.
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Date) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Date) Ptr ¶
Ptr returns a pointer to this Time's value that accept only fullyear,month,date and ignore elses. , or a nil pointer if this Time is null.
func (*Date) Scan ¶
Scan implements the Scanner interface. that accept only fullyear,month,date and ignore elses.
func (*Date) SetValid ¶
SetValid changes this Time's value that accept only fullyear,month,date and ignore elses. and sets it to be non-null.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Date) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Date) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type DateTime ¶
DateTime is a nullable time.Time that accept only fullyear,month,date,hour,minute,second and ignore elses. When it is serialize to JSON and vice versa only accept of SQL DateTime Format YYYY-MM-DD hh:mm:ss ([4 digit year]-[2 digit month]-[2 digit year] [2 digit hour]:[2 digit minute][2 digit second]). It supports SQL and JSON serialization.
func DateTimeFrom ¶
DateTimeFrom creates a new DateTime that will always be valid.
func DateTimeFromPtr ¶
DateTimeFromPtr creates a new DateTime that will be null if t is nil.
func NewDateTime ¶
NewDateTime creates a new Time. that accept only fullyear,month,date,hour,minute,second and ignore elses.
func (DateTime) IsZero ¶
IsZero returns true for an invalid Time's value, for potential future omitempty support.
func (DateTime) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (DateTime) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (DateTime) Ptr ¶
Ptr returns a pointer to this Time's value that accept only fullyear,month,date and ignore elses. , or a nil pointer if this Time is null.
func (*DateTime) Scan ¶
Scan implements the Scanner interface. that accept only fullyear,month,date and ignore elses.
func (*DateTime) SetValid ¶
SetValid changes this Time's value that accept only fullyear,month,date and ignore elses. and sets it to be non-null.
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*DateTime) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (DateTime) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Float32 ¶
Float32 is a nullable float32.
func Float32From ¶
Float32From creates a new Float32 that will always be valid.
func Float32FromPtr ¶
Float32FromPtr creates a new Float32 that be null if f is nil.
func (Float32) IsZero ¶
IsZero returns true for invalid Float32s, for future omitempty support (Go 1.4?)
func (Float32) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Float32) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Float32) Ptr ¶
Ptr returns a pointer to this Float32's value, or a nil pointer if this Float32 is null.
func (*Float32) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Float32) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Float32) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise zero.
type Float64 ¶
Float64 is a nullable float64.
func Float64From ¶
Float64From creates a new Float64 that will always be valid.
func Float64FromPtr ¶
Float64FromPtr creates a new Float64 that be null if f is nil.
func (Float64) IsZero ¶
IsZero returns true for invalid Float64s, for future omitempty support (Go 1.4?)
func (Float64) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Float64) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Float64) Ptr ¶
Ptr returns a pointer to this Float64's value, or a nil pointer if this Float64 is null.
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Float64) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Float64) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise zero.
type Int ¶
Int is an nullable int.
func IntFromPtr ¶
IntFromPtr creates a new Int that be null if i is nil.
func (Int) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Int) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Int) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Int) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Int16 ¶
Int16 is an nullable int16.
func Int16FromPtr ¶
Int16FromPtr creates a new Int16 that be null if i is nil.
func (Int16) IsZero ¶
IsZero returns true for invalid Int16's, for future omitempty support (Go 1.4?)
func (Int16) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Int16) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Int16) Ptr ¶
Ptr returns a pointer to this Int16's value, or a nil pointer if this Int16 is null.
func (*Int16) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Int16) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Int16) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Int32 ¶
Int32 is an nullable int32.
func Int32FromPtr ¶
Int32FromPtr creates a new Int32 that be null if i is nil.
func (Int32) IsZero ¶
IsZero returns true for invalid Int32's, for future omitempty support (Go 1.4?)
func (Int32) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Int32) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Int32) Ptr ¶
Ptr returns a pointer to this Int32's value, or a nil pointer if this Int32 is null.
func (*Int32) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Int32) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Int32) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Int64 ¶
Int64 is an nullable int64.
func Int64FromPtr ¶
Int64FromPtr creates a new Int64 that be null if i is nil.
func (Int64) IsZero ¶
IsZero returns true for invalid Int64's, for future omitempty support (Go 1.4?)
func (Int64) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Int64) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Int64) Ptr ¶
Ptr returns a pointer to this Int64's value, or a nil pointer if this Int64 is null.
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Int64) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Int64) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Int8 ¶
Int8 is an nullable int8.
func Int8FromPtr ¶
Int8FromPtr creates a new Int8 that be null if i is nil.
func (Int8) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Int8) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Int8) Ptr ¶
Ptr returns a pointer to this Int8's value, or a nil pointer if this Int8 is null.
func (*Int8) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Int8) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Int8) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type JSON ¶
JSON is a nullable []byte that contains JSON.
You might want to use this in the case where you have say a nullable JSON column in postgres for instance, where there is one layer of null for the postgres column, and then you also have the opportunity to have null as a value contained in the json. When unmarshalling json however you cannot set 'null' as a value.
func JSONFromPtr ¶
JSONFromPtr creates a new JSON that will be invalid if nil.
func (JSON) IsZero ¶
IsZero returns true for null or zero JSON's, for future omitempty support (Go 1.4?)
func (*JSON) Marshal ¶
Marshal will marshal the passed in object, and store it in the JSON member on the JSON object.
func (JSON) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (JSON) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (JSON) Ptr ¶
Ptr returns a pointer to this JSON's value, or a nil pointer if this JSON is null.
func (JSON) Unmarshal ¶
Unmarshal will unmarshal your JSON stored in your JSON object and store the result in the value pointed to by dest.
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
Example if you have a struct with a null.JSON called v:
{} -> does not call unmarshaljson: !set & !valid {"v": null} -> calls unmarshaljson, set & !valid {"v": {}} -> calls unmarshaljson, set & valid (json value is '{}')
That's to say if 'null' is passed in at the json level we do not capture that value - instead we set the value-level null flag so that an sql value will turn out null.
func (*JSON) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (JSON) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type String ¶
String is a nullable string. It supports SQL and JSON serialization.
func StringFrom ¶
StringFrom creates a new String that will never be blank.
func StringFromPtr ¶
StringFromPtr creates a new String that be null if s is nil.
func (String) IsZero ¶
IsZero returns true for null strings, for potential future omitempty support.
func (String) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (String) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (String) Ptr ¶
Ptr returns a pointer to this String's value, or a nil pointer if this String is null.
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*String) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (String) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Time ¶
Time is a nullable time.Time. It supports SQL and JSON serialization.
func TimeFromPtr ¶
TimeFromPtr creates a new Time that will be null if t is nil.
func (Time) IsZero ¶
IsZero returns true for an invalid Time's value, for potential future omitempty support.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Time) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Time) Ptr ¶
Ptr returns a pointer to this Time's value, or a nil pointer if this Time is null.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Time) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Time) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type TimeStamp ¶
TimeStamp is a nullable time.Time that accept only fullyear,month,date,hour,minute,second, and microsecond . When it is serialize to JSON and vice versa only accept of SQL DateTime Format YYYY-MM-DD hh:mm:ss ([4 digit year]-[2 digit month]-[2 digit year] [2 digit hour]:[2 digit minute][2 digit second].[6 digit microsecond]). It supports SQL and JSON serialization.
func NewTimeStamp ¶
NewTimeStamp creates a new Time. that accept only fullyear,month,date,hour,minute,second and microsecond.
func TimeStampFrom ¶
TimeStampFrom creates a new TimeStamp that will always be valid.
func TimeStampFromPtr ¶
TimeStampFromPtr creates a new TimeStamp that will be null if t is nil.
func (TimeStamp) IsZero ¶
IsZero returns true for an invalid Time's value, for potential future omitempty support.
func (TimeStamp) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (TimeStamp) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (TimeStamp) Ptr ¶
Ptr returns a pointer to this Time's value that accept only fullyear,month,date,hour,minute,second and microsecond. , or a nil pointer if this Time is null.
func (*TimeStamp) Scan ¶
Scan implements the Scanner interface. that accept only fullyear,month,date,hour,minute,second and microsecond.
func (*TimeStamp) SetValid ¶
SetValid changes this Time's value that accept only fullyear,month,date,hour,minute,second and microsecond. and sets it to be non-null.
func (*TimeStamp) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*TimeStamp) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (TimeStamp) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Uint ¶
Uint is an nullable uint.
func UintFromPtr ¶
UintFromPtr creates a new Uint that be null if i is nil.
func (Uint) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Uint) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Uint) Ptr ¶
Ptr returns a pointer to this Uint's value, or a nil pointer if this Uint is null.
func (*Uint) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Uint) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Uint16 ¶
Uint16 is an nullable uint16.
func Uint16From ¶
Uint16From creates a new Uint16 that will always be valid.
func Uint16FromPtr ¶
Uint16FromPtr creates a new Uint16 that be null if i is nil.
func (Uint16) IsZero ¶
IsZero returns true for invalid Uint16's, for future omitempty support (Go 1.4?)
func (Uint16) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Uint16) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Uint16) Ptr ¶
Ptr returns a pointer to this Uint16's value, or a nil pointer if this Uint16 is null.
func (*Uint16) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint16) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Uint16) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Uint32 ¶
Uint32 is an nullable uint32.
func Uint32From ¶
Uint32From creates a new Uint32 that will always be valid.
func Uint32FromPtr ¶
Uint32FromPtr creates a new Uint32 that be null if i is nil.
func (Uint32) IsZero ¶
IsZero returns true for invalid Uint32's, for future omitempty support (Go 1.4?)
func (Uint32) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Uint32) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Uint32) Ptr ¶
Ptr returns a pointer to this Uint32's value, or a nil pointer if this Uint32 is null.
func (*Uint32) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint32) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Uint32) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Uint64 ¶
Uint64 is an nullable uint64.
func Uint64From ¶
Uint64From creates a new Uint64 that will always be valid.
func Uint64FromPtr ¶
Uint64FromPtr creates a new Uint64 that be null if i is nil.
func (Uint64) IsZero ¶
IsZero returns true for invalid Uint64's, for future omitempty support (Go 1.4?)
func (Uint64) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Uint64) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Uint64) Ptr ¶
Ptr returns a pointer to this Uint64's value, or a nil pointer if this Uint64 is null.
func (*Uint64) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint64) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Uint64) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.
type Uint8 ¶
Uint8 is an nullable uint8.
func Uint8FromPtr ¶
Uint8FromPtr creates a new Uint8 that be null if i is nil.
func (Uint8) IsZero ¶
IsZero returns true for invalid Uint8's, for future omitempty support (Go 1.4?)
func (Uint8) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Uint8) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Uint8) Ptr ¶
Ptr returns a pointer to this Uint8's value, or a nil pointer if this Uint8 is null.
func (*Uint8) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Uint8) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
func (Uint8) ValueOrDefault ¶
ValueOrDefault returns the inner value if valid, otherwise default.