Documentation ¶
Overview ¶
Package box stores values that may be undefined, unknown, or empty.
Index ¶
- Constants
- type Bool
- func (box *Bool) Get() (bool, bool)
- func (box *Bool) GetCoerceNil() interface{}
- func (box *Bool) GetCoerceZero() bool
- func (box Bool) MarshalJSON() ([]byte, error)
- func (box *Bool) MustGet() bool
- func (box *Bool) Set(v bool)
- func (box *Bool) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Bool) SetCoerceZero(v bool, zeroStatus byte)
- func (box *Bool) SetEmpty()
- func (box *Bool) SetUndefined()
- func (box *Bool) SetUnknown()
- func (box *Bool) Status() byte
- type Float32
- func (box *Float32) Get() (float32, bool)
- func (box *Float32) GetCoerceNil() interface{}
- func (box *Float32) GetCoerceZero() float32
- func (box Float32) MarshalJSON() ([]byte, error)
- func (box *Float32) MustGet() float32
- func (box *Float32) Set(v float32)
- func (box *Float32) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Float32) SetCoerceZero(v float32, zeroStatus byte)
- func (box *Float32) SetEmpty()
- func (box *Float32) SetUndefined()
- func (box *Float32) SetUnknown()
- func (box *Float32) Status() byte
- type Float64
- func (box *Float64) Get() (float64, bool)
- func (box *Float64) GetCoerceNil() interface{}
- func (box *Float64) GetCoerceZero() float64
- func (box Float64) MarshalJSON() ([]byte, error)
- func (box *Float64) MustGet() float64
- func (box *Float64) Set(v float64)
- func (box *Float64) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Float64) SetCoerceZero(v float64, zeroStatus byte)
- func (box *Float64) SetEmpty()
- func (box *Float64) SetUndefined()
- func (box *Float64) SetUnknown()
- func (box *Float64) Status() byte
- type Int16
- func (box *Int16) Get() (int16, bool)
- func (box *Int16) GetCoerceNil() interface{}
- func (box *Int16) GetCoerceZero() int16
- func (box Int16) MarshalJSON() ([]byte, error)
- func (box *Int16) MustGet() int16
- func (box *Int16) Set(v int16)
- func (box *Int16) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Int16) SetCoerceZero(v int16, zeroStatus byte)
- func (box *Int16) SetEmpty()
- func (box *Int16) SetUndefined()
- func (box *Int16) SetUnknown()
- func (box *Int16) Status() byte
- type Int32
- func (box *Int32) Get() (int32, bool)
- func (box *Int32) GetCoerceNil() interface{}
- func (box *Int32) GetCoerceZero() int32
- func (box Int32) MarshalJSON() ([]byte, error)
- func (box *Int32) MustGet() int32
- func (box *Int32) Set(v int32)
- func (box *Int32) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Int32) SetCoerceZero(v int32, zeroStatus byte)
- func (box *Int32) SetEmpty()
- func (box *Int32) SetUndefined()
- func (box *Int32) SetUnknown()
- func (box *Int32) Status() byte
- type Int64
- func (box *Int64) Get() (int64, bool)
- func (box *Int64) GetCoerceNil() interface{}
- func (box *Int64) GetCoerceZero() int64
- func (box Int64) MarshalJSON() ([]byte, error)
- func (box *Int64) MustGet() int64
- func (box *Int64) Set(v int64)
- func (box *Int64) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Int64) SetCoerceZero(v int64, zeroStatus byte)
- func (box *Int64) SetEmpty()
- func (box *Int64) SetUndefined()
- func (box *Int64) SetUnknown()
- func (box *Int64) Status() byte
- type Int8
- func (box *Int8) Get() (int8, bool)
- func (box *Int8) GetCoerceNil() interface{}
- func (box *Int8) GetCoerceZero() int8
- func (box Int8) MarshalJSON() ([]byte, error)
- func (box *Int8) MustGet() int8
- func (box *Int8) Set(v int8)
- func (box *Int8) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Int8) SetCoerceZero(v int8, zeroStatus byte)
- func (box *Int8) SetEmpty()
- func (box *Int8) SetUndefined()
- func (box *Int8) SetUnknown()
- func (box *Int8) Status() byte
- type String
- func (box *String) Get() (string, bool)
- func (box *String) GetCoerceNil() interface{}
- func (box *String) GetCoerceZero() string
- func (box String) MarshalJSON() ([]byte, error)
- func (box *String) MustGet() string
- func (box *String) Set(v string)
- func (box *String) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *String) SetCoerceZero(v string, zeroStatus byte)
- func (box *String) SetEmpty()
- func (box *String) SetUndefined()
- func (box *String) SetUnknown()
- func (box *String) Status() byte
- type Time
- func (box *Time) Get() (time.Time, bool)
- func (box *Time) GetCoerceNil() interface{}
- func (box *Time) GetCoerceZero() time.Time
- func (box *Time) MustGet() time.Time
- func (box *Time) Set(v time.Time)
- func (box *Time) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *Time) SetCoerceZero(v time.Time, zeroStatus byte)
- func (box *Time) SetEmpty()
- func (box *Time) SetUndefined()
- func (box *Time) SetUnknown()
- func (box *Time) Status() byte
- type UInt16
- func (box *UInt16) Get() (uint16, bool)
- func (box *UInt16) GetCoerceNil() interface{}
- func (box *UInt16) GetCoerceZero() uint16
- func (box UInt16) MarshalJSON() ([]byte, error)
- func (box *UInt16) MustGet() uint16
- func (box *UInt16) Set(v uint16)
- func (box *UInt16) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *UInt16) SetCoerceZero(v uint16, zeroStatus byte)
- func (box *UInt16) SetEmpty()
- func (box *UInt16) SetUndefined()
- func (box *UInt16) SetUnknown()
- func (box *UInt16) Status() byte
- type UInt32
- func (box *UInt32) Get() (uint32, bool)
- func (box *UInt32) GetCoerceNil() interface{}
- func (box *UInt32) GetCoerceZero() uint32
- func (box UInt32) MarshalJSON() ([]byte, error)
- func (box *UInt32) MustGet() uint32
- func (box *UInt32) Set(v uint32)
- func (box *UInt32) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *UInt32) SetCoerceZero(v uint32, zeroStatus byte)
- func (box *UInt32) SetEmpty()
- func (box *UInt32) SetUndefined()
- func (box *UInt32) SetUnknown()
- func (box *UInt32) Status() byte
- type UInt64
- func (box *UInt64) Get() (uint64, bool)
- func (box *UInt64) GetCoerceNil() interface{}
- func (box *UInt64) GetCoerceZero() uint64
- func (box UInt64) MarshalJSON() ([]byte, error)
- func (box *UInt64) MustGet() uint64
- func (box *UInt64) Set(v uint64)
- func (box *UInt64) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *UInt64) SetCoerceZero(v uint64, zeroStatus byte)
- func (box *UInt64) SetEmpty()
- func (box *UInt64) SetUndefined()
- func (box *UInt64) SetUnknown()
- func (box *UInt64) Status() byte
- type UInt8
- func (box *UInt8) Get() (uint8, bool)
- func (box *UInt8) GetCoerceNil() interface{}
- func (box *UInt8) GetCoerceZero() uint8
- func (box UInt8) MarshalJSON() ([]byte, error)
- func (box *UInt8) MustGet() uint8
- func (box *UInt8) Set(v uint8)
- func (box *UInt8) SetCoerceNil(v interface{}, nilStatus byte)
- func (box *UInt8) SetCoerceZero(v uint8, zeroStatus byte)
- func (box *UInt8) SetEmpty()
- func (box *UInt8) SetUndefined()
- func (box *UInt8) SetUnknown()
- func (box *UInt8) Status() byte
Constants ¶
const ( Undefined = iota Unknown = iota Empty = iota Full = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (*Bool) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Bool) GetCoerceNil ¶
func (box *Bool) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Bool) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Bool) MarshalJSON ¶
func (*Bool) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Bool) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type Float32 ¶
type Float32 struct {
// contains filtered or unexported fields
}
func NewFloat32 ¶
NewFloat32 returns a Float32 initialized to v
func (*Float32) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Float32) GetCoerceNil ¶
func (box *Float32) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Float32) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Float32) MarshalJSON ¶
func (*Float32) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Float32) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
func (*Float32) SetUndefined ¶
func (box *Float32) SetUndefined()
SetUndefined sets box to Undefined
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
func NewFloat64 ¶
NewFloat64 returns a Float64 initialized to v
func (*Float64) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Float64) GetCoerceNil ¶
func (box *Float64) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Float64) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Float64) MarshalJSON ¶
func (*Float64) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Float64) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
func (*Float64) SetUndefined ¶
func (box *Float64) SetUndefined()
SetUndefined sets box to Undefined
type Int16 ¶
type Int16 struct {
// contains filtered or unexported fields
}
func (*Int16) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Int16) GetCoerceNil ¶
func (box *Int16) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Int16) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Int16) MarshalJSON ¶
func (*Int16) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Int16) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type Int32 ¶
type Int32 struct {
// contains filtered or unexported fields
}
func (*Int32) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Int32) GetCoerceNil ¶
func (box *Int32) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Int32) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Int32) MarshalJSON ¶
func (*Int32) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Int32) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type Int64 ¶
type Int64 struct {
// contains filtered or unexported fields
}
func (*Int64) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Int64) GetCoerceNil ¶
func (box *Int64) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Int64) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Int64) MarshalJSON ¶
func (*Int64) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Int64) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type Int8 ¶
type Int8 struct {
// contains filtered or unexported fields
}
func (*Int8) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Int8) GetCoerceNil ¶
func (box *Int8) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Int8) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (Int8) MarshalJSON ¶
func (*Int8) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Int8) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (*String) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*String) GetCoerceNil ¶
func (box *String) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*String) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (String) MarshalJSON ¶
func (*String) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*String) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func (*Time) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*Time) GetCoerceNil ¶
func (box *Time) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*Time) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (*Time) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*Time) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type UInt16 ¶
type UInt16 struct {
// contains filtered or unexported fields
}
func (*UInt16) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*UInt16) GetCoerceNil ¶
func (box *UInt16) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*UInt16) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (UInt16) MarshalJSON ¶
func (*UInt16) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*UInt16) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type UInt32 ¶
type UInt32 struct {
// contains filtered or unexported fields
}
func (*UInt32) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*UInt32) GetCoerceNil ¶
func (box *UInt32) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*UInt32) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (UInt32) MarshalJSON ¶
func (*UInt32) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*UInt32) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type UInt64 ¶
type UInt64 struct {
// contains filtered or unexported fields
}
func (*UInt64) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*UInt64) GetCoerceNil ¶
func (box *UInt64) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*UInt64) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (UInt64) MarshalJSON ¶
func (*UInt64) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*UInt64) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus
type UInt8 ¶
type UInt8 struct {
// contains filtered or unexported fields
}
func (*UInt8) Get ¶
Get returns the value and present. present is true only if the box is Full and value is valid
func (*UInt8) GetCoerceNil ¶
func (box *UInt8) GetCoerceNil() interface{}
GetCoerceNil returns the value if the box is full, otherwise it returns nil
func (*UInt8) GetCoerceZero ¶
GetCoerceZero returns value if the box is full, otherwise it returns the zero value
func (UInt8) MarshalJSON ¶
func (*UInt8) SetCoerceNil ¶
SetCoerceNil places v in box if v is not nil, otherwise it sets box to nilStatus
func (*UInt8) SetCoerceZero ¶
SetCoerceZero places v in box if v is not the zero value, otherwise it sets box to zeroStatus