Documentation
¶
Index ¶
- Constants
- Variables
- func NullBoolSlice(null []NullBool, valid bool) []bool
- func NullComplex64Slice(null []NullComplex64, valid bool) []complex64
- func NullComplexSlice(null []NullComplex, valid bool) []complex128
- func NullFloat32Slice(null []NullFloat32, valid bool) []float32
- func NullFloatSlice(null []NullFloat, valid bool) []float64
- func NullInt16Slice(null []NullInt16, valid bool) []int16
- func NullInt32Slice(null []NullInt32, valid bool) []int32
- func NullInt64Slice(null []NullInt64, valid bool) []int64
- func NullInt8Slice(null []NullInt8, valid bool) []int8
- func NullIntSlice(null []NullInt, valid bool) []int
- func NullInterfaceSlice(null []NullInterface, valid bool) []interface{}
- func NullStringSlice(null []NullString, valid bool) []string
- func NullTimeSlice(null []NullTime, valid bool) []time.Time
- func NullUint16Slice(null []NullUint16, valid bool) []uint16
- func NullUint32Slice(null []NullUint32, valid bool) []uint32
- func NullUint64Slice(null []NullUint64, valid bool) []uint64
- func NullUint8Slice(null []NullUint8, valid bool) []uint8
- func NullUintSlice(null []NullUint, valid bool) []uint
- func NumericToString(v interface{}, base int, fmtByte byte, prec int) string
- type ComplexStringOption
- type ErrorConvert
- type ErrorInvalidArgument
- type ErrorOutOfBounds
- type ErrorOutOfRange
- type ErrorPanic
- type ErrorUnexpectedValue
- type FloatStringOption
- type IntStringOption
- type NullBool
- func (n NullBool) MarshalJSON() ([]byte, error)
- func (n NullBool) Present() bool
- func (n *NullBool) Scan(value interface{}) error
- func (n *NullBool) Set(value bool)
- func (n NullBool) Typ(options ...Option) *Type
- func (n *NullBool) UnmarshalJSON(b []byte) error
- func (n NullBool) V() bool
- func (n NullBool) Valid() bool
- func (n NullBool) Value() (driver.Value, error)
- type NullComplex
- func (n NullComplex) MarshalJSON() ([]byte, error)
- func (n NullComplex) Present() bool
- func (n *NullComplex) Scan(value interface{}) error
- func (n *NullComplex) Set(value complex128)
- func (n NullComplex) Typ(options ...Option) *Type
- func (n *NullComplex) UnmarshalJSON(b []byte) error
- func (n NullComplex) V() complex128
- func (n NullComplex) Valid() bool
- func (n NullComplex) Value() (driver.Value, error)
- type NullComplex64
- func Complex64(from complex128, defaultValue ...complex64) (nv NullComplex64)
- func Float32Complex64(from float32, defaultValue ...complex64) (nv NullComplex64)
- func FloatComplex64(from float64, defaultValue ...complex64) (nv NullComplex64)
- func IntComplex64(from int64, defaultValue ...complex64) (nv NullComplex64)
- func NComplex64(value complex64) NullComplex64
- func StringComplex64(from string, defaultValue ...complex64) (nv NullComplex64)
- func UintComplex64(from uint64, defaultValue ...complex64) (nv NullComplex64)
- func (n NullComplex64) MarshalJSON() ([]byte, error)
- func (n NullComplex64) Present() bool
- func (n *NullComplex64) Scan(value interface{}) error
- func (n *NullComplex64) Set(value complex64)
- func (n NullComplex64) Typ(options ...Option) *Type
- func (n *NullComplex64) UnmarshalJSON(b []byte) error
- func (n NullComplex64) V() complex64
- func (n NullComplex64) Valid() bool
- func (n NullComplex64) Value() (driver.Value, error)
- type NullFloat
- func Complex64Float64(from complex64, defaultValue ...float64) (nv NullFloat)
- func ComplexFloat64(from complex128, defaultValue ...float64) (nv NullFloat)
- func IntFloat(from int64, defaultValue ...float64) (nv NullFloat)
- func NFloat(value float64) NullFloat
- func StringFloat(from string, defaultValue ...float64) (nv NullFloat)
- func UintFloat(from uint64, defaultValue ...float64) (nv NullFloat)
- func (n NullFloat) MarshalJSON() ([]byte, error)
- func (n NullFloat) Present() bool
- func (n *NullFloat) Scan(value interface{}) error
- func (n *NullFloat) Set(value float64)
- func (n NullFloat) Typ(options ...Option) *Type
- func (n *NullFloat) UnmarshalJSON(b []byte) error
- func (n NullFloat) V() float64
- func (n NullFloat) Valid() bool
- func (n NullFloat) Value() (driver.Value, error)
- type NullFloat32
- func Complex64Float32(from complex64, defaultValue ...float32) (nv NullFloat32)
- func ComplexFloat32(from complex128, defaultValue ...float32) (nv NullFloat32)
- func Float32(from float64, defaultValue ...float32) (nv NullFloat32)
- func IntFloat32(from int64, defaultValue ...float32) (nv NullFloat32)
- func NFloat32(value float32) NullFloat32
- func StringFloat32(from string, defaultValue ...float32) (nv NullFloat32)
- func UintFloat32(from uint64, defaultValue ...float32) (nv NullFloat32)
- func (n NullFloat32) MarshalJSON() ([]byte, error)
- func (n NullFloat32) Present() bool
- func (n *NullFloat32) Scan(value interface{}) error
- func (n *NullFloat32) Set(value float32)
- func (n NullFloat32) Typ(options ...Option) *Type
- func (n *NullFloat32) UnmarshalJSON(b []byte) error
- func (n NullFloat32) V() float32
- func (n NullFloat32) Valid() bool
- func (n NullFloat32) Value() (driver.Value, error)
- type NullInt
- func Complex64Int(from complex64, defaultValue ...int) (nv NullInt)
- func ComplexInt(from complex128, defaultValue ...int) (nv NullInt)
- func Float32Int(from float32, defaultValue ...int) (nv NullInt)
- func FloatInt(from float64, defaultValue ...int) (nv NullInt)
- func NInt(value int) NullInt
- func StringInt(from string, defaultValue ...int) (nv NullInt)
- func (n NullInt) MarshalJSON() ([]byte, error)
- func (n NullInt) Present() bool
- func (n *NullInt) Scan(value interface{}) error
- func (n *NullInt) Set(value int)
- func (n NullInt) Typ(options ...Option) *Type
- func (n *NullInt) UnmarshalJSON(b []byte) error
- func (n NullInt) V() int
- func (n NullInt) Valid() bool
- func (n NullInt) Value() (driver.Value, error)
- type NullInt16
- func Complex64Int16(from complex64, defaultValue ...int16) (nv NullInt16)
- func ComplexInt16(from complex128, defaultValue ...int16) (nv NullInt16)
- func Float32Int16(from float32, defaultValue ...int16) (nv NullInt16)
- func FloatInt16(from float64, defaultValue ...int16) (nv NullInt16)
- func Int16(from int64, defaultValue ...int16) (nv NullInt16)
- func NInt16(value int16) NullInt16
- func StringInt16(from string, defaultValue ...int16) (nv NullInt16)
- func UintInt16(from uint64, defaultValue ...int16) (nv NullInt16)
- func (n NullInt16) MarshalJSON() ([]byte, error)
- func (n NullInt16) Present() bool
- func (n *NullInt16) Scan(value interface{}) error
- func (n *NullInt16) Set(value int16)
- func (n NullInt16) Typ(options ...Option) *Type
- func (n *NullInt16) UnmarshalJSON(b []byte) error
- func (n NullInt16) V() int16
- func (n NullInt16) Valid() bool
- func (n NullInt16) Value() (driver.Value, error)
- type NullInt32
- func Complex64Int32(from complex64, defaultValue ...int32) (nv NullInt32)
- func ComplexInt32(from complex128, defaultValue ...int32) (nv NullInt32)
- func Float32Int32(from float32, defaultValue ...int32) (nv NullInt32)
- func FloatInt32(from float64, defaultValue ...int32) (nv NullInt32)
- func Int32(from int64, defaultValue ...int32) (nv NullInt32)
- func NInt32(value int32) NullInt32
- func StringInt32(from string, defaultValue ...int32) (nv NullInt32)
- func UintInt32(from uint64, defaultValue ...int32) (nv NullInt32)
- func (n NullInt32) MarshalJSON() ([]byte, error)
- func (n NullInt32) Present() bool
- func (n *NullInt32) Scan(value interface{}) error
- func (n *NullInt32) Set(value int32)
- func (n NullInt32) Typ(options ...Option) *Type
- func (n *NullInt32) UnmarshalJSON(b []byte) error
- func (n NullInt32) V() int32
- func (n NullInt32) Valid() bool
- func (n NullInt32) Value() (driver.Value, error)
- type NullInt64
- func Complex64Int64(from complex64, defaultValue ...int64) (nv NullInt64)
- func ComplexInt64(from complex128, defaultValue ...int64) (nv NullInt64)
- func Float32Int64(from float32, defaultValue ...int64) (nv NullInt64)
- func FloatInt64(from float64, defaultValue ...int64) (nv NullInt64)
- func NInt64(value int64) NullInt64
- func StringInt64(from string, defaultValue ...int64) (nv NullInt64)
- func UintInt64(from uint64, defaultValue ...int64) (nv NullInt64)
- func (n NullInt64) MarshalJSON() ([]byte, error)
- func (n NullInt64) Present() bool
- func (n *NullInt64) Scan(value interface{}) error
- func (n *NullInt64) Set(value int64)
- func (n NullInt64) Typ(options ...Option) *Type
- func (n *NullInt64) UnmarshalJSON(b []byte) error
- func (n NullInt64) V() int64
- func (n NullInt64) Valid() bool
- func (n NullInt64) Value() (driver.Value, error)
- type NullInt8
- func Complex64Int8(from complex64, defaultValue ...int8) (nv NullInt8)
- func ComplexInt8(from complex128, defaultValue ...int8) (nv NullInt8)
- func Float32Int8(from float32, defaultValue ...int8) (nv NullInt8)
- func FloatInt8(from float64, defaultValue ...int8) (nv NullInt8)
- func Int8(from int64, defaultValue ...int8) (nv NullInt8)
- func NInt8(value int8) NullInt8
- func StringInt8(from string, defaultValue ...int8) (nv NullInt8)
- func UintInt8(from uint64, defaultValue ...int8) (nv NullInt8)
- func (n NullInt8) MarshalJSON() ([]byte, error)
- func (n NullInt8) Present() bool
- func (n *NullInt8) Scan(value interface{}) error
- func (n *NullInt8) Set(value int8)
- func (n NullInt8) Typ(options ...Option) *Type
- func (n *NullInt8) UnmarshalJSON(b []byte) error
- func (n NullInt8) V() int8
- func (n NullInt8) Valid() bool
- func (n NullInt8) Value() (driver.Value, error)
- type NullInterface
- func (n NullInterface) MarshalJSON() ([]byte, error)
- func (n NullInterface) Present() bool
- func (n *NullInterface) Scan(value interface{}) error
- func (n *NullInterface) Set(value interface{})
- func (n NullInterface) Typ(options ...Option) *Type
- func (n *NullInterface) UnmarshalJSON(b []byte) error
- func (n NullInterface) V() interface{}
- func (n NullInterface) Valid() bool
- func (n NullInterface) Value() (driver.Value, error)
- type NullString
- func BoolString(from bool) (nv NullString)
- func ComplexString(from complex128, options ...ComplexStringOption) (nv NullString)
- func Concat(values []interface{}, options ...Option) NullString
- func FloatString(from float64, options ...FloatStringOption) (nv NullString)
- func IntString(from int64, options ...IntStringOption) (nv NullString)
- func NString(value string) NullString
- func UintString(from uint64, options ...UintStringOption) (nv NullString)
- func (n NullString) MarshalJSON() ([]byte, error)
- func (n NullString) Present() bool
- func (n *NullString) Scan(value interface{}) error
- func (n *NullString) Set(value string)
- func (n NullString) Typ(options ...Option) *Type
- func (n *NullString) UnmarshalJSON(b []byte) error
- func (n NullString) V() string
- func (n NullString) Valid() bool
- func (n NullString) Value() (driver.Value, error)
- type NullTime
- func (n NullTime) MarshalJSON() ([]byte, error)
- func (n NullTime) Present() bool
- func (n *NullTime) Scan(value interface{}) error
- func (n *NullTime) Set(value time.Time)
- func (n *NullTime) UnmarshalJSON(b []byte) error
- func (n NullTime) V() time.Time
- func (n NullTime) Valid() bool
- func (n NullTime) Value() (driver.Value, error)
- type NullUint
- func Complex64Uint(from complex64, defaultValue ...uint) (nv NullUint)
- func ComplexUint(from complex128, defaultValue ...uint) (nv NullUint)
- func Float32Uint(from float32, defaultValue ...uint) (nv NullUint)
- func FloatUint(from float64, defaultValue ...uint) (nv NullUint)
- func NUint(value uint) NullUint
- func StringUint(from string, defaultValue ...uint) (nv NullUint)
- func (n NullUint) MarshalJSON() ([]byte, error)
- func (n NullUint) Present() bool
- func (n *NullUint) Scan(value interface{}) error
- func (n *NullUint) Set(value uint)
- func (n NullUint) Typ(options ...Option) *Type
- func (n *NullUint) UnmarshalJSON(b []byte) error
- func (n NullUint) V() uint
- func (n NullUint) Valid() bool
- func (n NullUint) Value() (driver.Value, error)
- type NullUint16
- func Complex64Uint16(from complex64, defaultValue ...uint16) (nv NullUint16)
- func ComplexUint16(from complex128, defaultValue ...uint16) (nv NullUint16)
- func Float32Uint16(from float32, defaultValue ...uint16) (nv NullUint16)
- func FloatUint16(from float64, defaultValue ...uint16) (nv NullUint16)
- func IntUint16(from int64, defaultValue ...uint16) (nv NullUint16)
- func NUint16(value uint16) NullUint16
- func StringUint16(from string, defaultValue ...uint16) (nv NullUint16)
- func Uint16(from uint64, defaultValue ...uint16) (nv NullUint16)
- func (n NullUint16) MarshalJSON() ([]byte, error)
- func (n NullUint16) Present() bool
- func (n *NullUint16) Scan(value interface{}) error
- func (n *NullUint16) Set(value uint16)
- func (n NullUint16) Typ(options ...Option) *Type
- func (n *NullUint16) UnmarshalJSON(b []byte) error
- func (n NullUint16) V() uint16
- func (n NullUint16) Valid() bool
- func (n NullUint16) Value() (driver.Value, error)
- type NullUint32
- func Complex64Uint32(from complex64, defaultValue ...uint32) (nv NullUint32)
- func ComplexUint32(from complex128, defaultValue ...uint32) (nv NullUint32)
- func Float32Uint32(from float32, defaultValue ...uint32) (nv NullUint32)
- func FloatUint32(from float64, defaultValue ...uint32) (nv NullUint32)
- func IntUint32(from int64, defaultValue ...uint32) (nv NullUint32)
- func NUint32(value uint32) NullUint32
- func StringUint32(from string, defaultValue ...uint32) (nv NullUint32)
- func Uint32(from uint64, defaultValue ...uint32) (nv NullUint32)
- func (n NullUint32) MarshalJSON() ([]byte, error)
- func (n NullUint32) Present() bool
- func (n *NullUint32) Scan(value interface{}) error
- func (n *NullUint32) Set(value uint32)
- func (n NullUint32) Typ(options ...Option) *Type
- func (n *NullUint32) UnmarshalJSON(b []byte) error
- func (n NullUint32) V() uint32
- func (n NullUint32) Valid() bool
- func (n NullUint32) Value() (driver.Value, error)
- type NullUint64
- func Complex64Uint64(from complex64, defaultValue ...uint64) (nv NullUint64)
- func ComplexUint64(from complex128, defaultValue ...uint64) (nv NullUint64)
- func Float32Uint64(from float32, defaultValue ...uint64) (nv NullUint64)
- func FloatUint64(from float64, defaultValue ...uint64) (nv NullUint64)
- func IntUint64(from int64, defaultValue ...uint64) (nv NullUint64)
- func NUint64(value uint64) NullUint64
- func StringUint64(from string, defaultValue ...uint64) (nv NullUint64)
- func (n NullUint64) MarshalJSON() ([]byte, error)
- func (n NullUint64) Present() bool
- func (n *NullUint64) Scan(value interface{}) error
- func (n *NullUint64) Set(value uint64)
- func (n NullUint64) Typ(options ...Option) *Type
- func (n *NullUint64) UnmarshalJSON(b []byte) error
- func (n NullUint64) V() uint64
- func (n NullUint64) Valid() bool
- func (n NullUint64) Value() (driver.Value, error)
- type NullUint8
- func Complex64Uint8(from complex64, defaultValue ...uint8) (nv NullUint8)
- func ComplexUint8(from complex128, defaultValue ...uint8) (nv NullUint8)
- func Float32Uint8(from float32, defaultValue ...uint8) (nv NullUint8)
- func FloatUint8(from float64, defaultValue ...uint8) (nv NullUint8)
- func IntUint8(from int64, defaultValue ...uint8) (nv NullUint8)
- func NUint8(value uint8) NullUint8
- func StringUint8(from string, defaultValue ...uint8) (nv NullUint8)
- func Uint8(from uint64, defaultValue ...uint8) (nv NullUint8)
- func (n NullUint8) MarshalJSON() ([]byte, error)
- func (n NullUint8) Present() bool
- func (n *NullUint8) Scan(value interface{}) error
- func (n *NullUint8) Set(value uint8)
- func (n NullUint8) Typ(options ...Option) *Type
- func (n *NullUint8) UnmarshalJSON(b []byte) error
- func (n NullUint8) V() uint8
- func (n NullUint8) Valid() bool
- func (n NullUint8) Value() (driver.Value, error)
- type Option
- type Type
- func (t *Type) Bool() (nv NullBool)
- func (t *Type) BoolHumanize() (nv NullBool)
- func (t *Type) BoolPositive() (nv NullBool)
- func (t *Type) Complex(defaultValue ...complex128) (nv NullComplex)
- func (t *Type) Complex64(defaultValue ...complex64) (nv NullComplex64)
- func (t *Type) Empty() (nv NullBool)
- func (t *Type) Equals(value interface{}) NullBool
- func (t *Type) Error() error
- func (t *Type) Float(defaultValue ...float64) (nv NullFloat)
- func (t *Type) Float32(defaultValue ...float32) (nv NullFloat32)
- func (t *Type) Get(argIndexes ...interface{}) (typ *Type)
- func (t *Type) Identical(src interface{}) (nv NullBool)
- func (t *Type) Int(defaultValue ...int) (nv NullInt)
- func (t *Type) Int16(defaultValue ...int16) (nv NullInt16)
- func (t *Type) Int32(defaultValue ...int32) (nv NullInt32)
- func (t *Type) Int64(defaultValue ...int64) (nv NullInt64)
- func (t *Type) Int8(defaultValue ...int8) (nv NullInt8)
- func (t *Type) Interface() (nv NullInterface)
- func (t *Type) IsBool(indirect ...bool) bool
- func (t *Type) IsComplex(indirect ...bool) bool
- func (t *Type) IsComplex128(indirect ...bool) bool
- func (t *Type) IsComplex64(indirect ...bool) bool
- func (t *Type) IsComposite(indirect ...bool) bool
- func (t *Type) IsFloat(indirect ...bool) bool
- func (t *Type) IsFloat32(indirect ...bool) bool
- func (t *Type) IsFloat64(indirect ...bool) bool
- func (t *Type) IsInt(indirect ...bool) bool
- func (t *Type) IsNumeric(indirect ...bool) bool
- func (t *Type) IsPointer(indirect ...bool) bool
- func (t *Type) IsPrimitives(indirect ...bool) bool
- func (t *Type) IsString(indirect ...bool) bool
- func (t *Type) IsUint(indirect ...bool) bool
- func (t *Type) Kind(indirect ...bool) reflect.Kind
- func (t *Type) OptionBase() int
- func (t *Type) OptionFmtByte() byte
- func (t *Type) OptionPrecision() int
- func (t *Type) String() (nv NullString)
- func (t *Type) StringBool() (nv NullString)
- func (t *Type) StringComplex(defaultValue ...complex64) (nv NullString)
- func (t *Type) StringDefault(defaultValue string) (nv NullString)
- func (t *Type) StringEmpty() (nv NullString)
- func (t *Type) StringFloat(defaultValue ...float32) (nv NullString)
- func (t *Type) StringInt() (nv NullString)
- func (t *Type) Uint(defaultValue ...uint) (nv NullUint)
- func (t *Type) Uint16(defaultValue ...uint16) (nv NullUint16)
- func (t *Type) Uint32(defaultValue ...uint32) (nv NullUint32)
- func (t *Type) Uint64(defaultValue ...uint64) (nv NullUint64)
- func (t *Type) Uint8(defaultValue ...uint8) (nv NullUint8)
- type UintStringOption
Constants ¶
const ( MinFloat32 = float32(-3.40282346638528859811704183484516925440e+38) MaxFloat32 = float32(3.40282346638528859811704183484516925440e+38) MinSafeIntFloat32 = float32(-1.6777215e+07) MaxSafeIntFloat32 = float32(1.6777215e+07) MinFloat64 = float64(-1.797693134862315708145274237317043567981e+308) MaxFloat64 = float64(1.797693134862315708145274237317043567981e+308) MinSafeIntFloat64 = float64(-9.007199254740991e+15) MaxSafeIntFloat64 = float64(9.007199254740991e+15) MaxInt8 = int8(127) MinInt8 = int8(-128) MaxInt16 = int16(32767) MinInt16 = int16(-32768) MaxInt32 = int32(2147483647) MinInt32 = int32(-2147483648) MaxInt64 = int64(9223372036854775807) MinInt64 = int64(-9223372036854775808) MaxInt = int(9223372036854775807) MinInt = int(-9223372036854775808) MaxUint8 = uint8(255) MaxUint16 = uint16(65535) MaxUint32 = uint32(4294967295) MaxUint64 = uint64(18446744073709551615) MaxUint = uint64(18446744073709551615) )
Min and Max values in primitive types
Variables ¶
var ( // ErrConvert is returned when value can't safely convert ErrConvert = ErrorConvert(errors.New("value can't safely convert")) // ErrOutOfRange is returned when value out of range on given data ErrOutOfRange = ErrorOutOfRange(errors.New("out of range on given data")) // ErrOutOfBounds is returned when value out of bounds on given data ErrOutOfBounds = ErrorOutOfBounds(errors.New("out of bounds on given data")) // ErrUnexpectedValue is returned when unexpected value given on data ErrUnexpectedValue = ErrorUnexpectedValue(errors.New("unexpected value given on data")) // ErrInvalidArgument is returned when invalid argument is present ErrInvalidArgument = ErrorInvalidArgument(errors.New("invalid argument")) // ErrDefaultValue is returned when default value is ambiguous ErrDefaultValue = ErrorInvalidArgument(errors.New("default value is ambiguous")) )
var ( // ErrBaseInvalid is returned when a base option has invalid range ErrBaseInvalid = ErrorInvalidArgument(errors.New("base option must be in range 2 <= base <= 36")) // ErrFmtByteInvalid is returned when a fmt byte has invalid value ErrFmtByteInvalid = ErrorInvalidArgument(errors.New("fmtByte option must be one of 'b', 'e', 'E', 'f', 'g', 'G'")) )
Functions ¶
func NullBoolSlice ¶
NullBoolSlice returns slice of bool with filled values from slice of NullBool
func NullComplex64Slice ¶
func NullComplex64Slice(null []NullComplex64, valid bool) []complex64
NullComplex64Slice returns slice of complex64 with filled values from slice of NullComplex64
func NullComplexSlice ¶
func NullComplexSlice(null []NullComplex, valid bool) []complex128
NullComplexSlice returns slice of complex128 with filled values from slice of NullComplex
func NullFloat32Slice ¶
func NullFloat32Slice(null []NullFloat32, valid bool) []float32
NullFloat32Slice returns slice of float32 with filled values from slice of NullFloat32
func NullFloatSlice ¶
NullFloatSlice returns slice of float64 with filled values from slice of NullFloat
func NullInt16Slice ¶
NullInt16Slice returns slice of int16 with filled values from slice of NullInt16
func NullInt32Slice ¶
NullInt32Slice returns slice of int32 with filled values from slice of NullInt32
func NullInt64Slice ¶
NullInt64Slice returns slice of int64 with filled values from slice of NullInt64
func NullInt8Slice ¶
NullInt8Slice returns slice of int8 with filled values from slice of NullInt8
func NullIntSlice ¶
NullIntSlice returns slice of int with filled values from slice of NullInt
func NullInterfaceSlice ¶
func NullInterfaceSlice(null []NullInterface, valid bool) []interface{}
NullInterfaceSlice returns slice of interface{} with filled values from slice of NullInterface
func NullStringSlice ¶
func NullStringSlice(null []NullString, valid bool) []string
NullStringSlice returns slice of string with filled values from slice of NullString
func NullTimeSlice ¶
NullTimeSlice returns slice of time.Time with filled values from slice of NullTime
func NullUint16Slice ¶
func NullUint16Slice(null []NullUint16, valid bool) []uint16
NullUint16Slice returns slice of uint16 with filled values from slice of NullUint16
func NullUint32Slice ¶
func NullUint32Slice(null []NullUint32, valid bool) []uint32
NullUint32Slice returns slice of uint32 with filled values from slice of NullUint32
func NullUint64Slice ¶
func NullUint64Slice(null []NullUint64, valid bool) []uint64
NullUint64Slice returns slice of uint64 with filled values from slice of NullUint64
func NullUint8Slice ¶
NullUint8Slice returns slice of uint8 with filled values from slice of NullUint8
func NullUintSlice ¶
NullUintSlice returns slice of uint with filled values from slice of NullUint
func NumericToString ¶
NumericToString convert from any numeric type to string in the given base for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10. The format fmt is one of 'b' (-ddddp±ddd, a binary exponent), 'e' (-d.dddde±dd, a decimal exponent), 'E' (-d.ddddE±dd, a decimal exponent), 'f' (-ddd.dddd, no exponent), 'g' ('e' for large exponents, 'f' otherwise), or 'G' ('E' for large exponents, 'f' otherwise). The special precision -1 uses the smallest number of digits necessary such that ParseFloat will return f exactly.
Types ¶
type ComplexStringOption ¶
type ComplexStringOption func(*complexStrOpts) error
ComplexStringOption is interface function used as argument value for type conversion configuration from complex to string
func ComplexStringDefault ¶
func ComplexStringDefault(value string) ComplexStringOption
ComplexStringDefault set default string value for complex conversion to string.
type ErrorConvert ¶
type ErrorConvert error
ErrorConvert is returned when value can't safely convert
type ErrorInvalidArgument ¶
type ErrorInvalidArgument error
ErrorInvalidArgument is returned when invalid argument is present
type ErrorOutOfBounds ¶
type ErrorOutOfBounds error
ErrorOutOfBounds is returned when value out of bounds on given data
type ErrorOutOfRange ¶
type ErrorOutOfRange error
ErrorOutOfRange is returned when value out of range on given data
type ErrorUnexpectedValue ¶
type ErrorUnexpectedValue error
ErrorUnexpectedValue is returned when unexpected value given on data
type FloatStringOption ¶
type FloatStringOption func(*floatStrOpts) error
FloatStringOption is interface function used as argument value for type conversion configuration from float to string
func FloatStringBitSize ¶
func FloatStringBitSize(value int) FloatStringOption
FloatStringBitSize set bit size for float conversion to string. The bitSize must be 32 or 64
func FloatStringDefault ¶
func FloatStringDefault(value string) FloatStringOption
FloatStringDefault set default string value for float conversion to string.
func FloatStringFmtByte ¶
func FloatStringFmtByte(value byte) FloatStringOption
FloatStringFmtByte set format for float conversion to string. The precision prec controls the number of digits (excluding the exponent) printed by the 'e', 'E', 'f', 'g', and 'G' formats. For 'e', 'E', and 'f' it is the number of digits after the decimal point. For 'g' and 'G' it is the maximum number of significant digits (trailing zeros are removed). The special precision -1 uses the smallest number of digits necessary such that ParseFloat will return f exactly.
func FloatStringPrecision ¶
func FloatStringPrecision(value int) FloatStringOption
FloatStringPrecision set precision for float conversion to string. The precision prec controls the number of digits (excluding the exponent) printed by the 'e', 'E', 'f', 'g', and 'G' formats. For 'e', 'E', and 'f' it is the number of digits after the decimal point. For 'g' and 'G' it is the maximum number of significant digits (trailing zeros are removed). The special precision -1 uses the smallest number of digits necessary such that ParseFloat will return f exactly.
type IntStringOption ¶
type IntStringOption func(*intStrOpts) error
IntStringOption is interface function used as argument value for type conversion configuration from int to string
func IntStringBase ¶
func IntStringBase(value int) IntStringOption
IntStringBase set base for int conversion to string. The base must be 2 <= base <= 36 for digit values >= 10.
func IntStringDefault ¶
func IntStringDefault(value string) IntStringOption
IntStringDefault set default string value for int conversion to string.
type NullBool ¶
NullBool represents an bool that may be null.
func StringBoolHumanize ¶
StringBoolHumanize convert value from string to bool. Returns false for string 'false' in case-insensitive mode or string equals '0'
func (NullBool) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullBool) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullBool) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullComplex ¶
type NullComplex struct { P *complex128 Error error }
NullComplex represents a complex128 that may be null.
func IntComplex ¶
func IntComplex(from int64, defaultValue ...complex128) (nv NullComplex)
IntComplex convert value from int64 to complex128. Returns value if type can safely converted, otherwise error & default value in result values
func NComplex ¶
func NComplex(value complex128) NullComplex
NComplex returns NullComplex from complex128
func StringComplex ¶
func StringComplex(from string, defaultValue ...complex128) (nv NullComplex)
StringComplex convert value from string to complex128. Returns value if type can safely converted, otherwise error & default value in result values
func UintComplex ¶
func UintComplex(from uint64, defaultValue ...complex128) (nv NullComplex)
UintComplex convert value from uint64 to complex128. Returns value if type can safely converted, otherwise error & default value in result values
func (NullComplex) MarshalJSON ¶
func (n NullComplex) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullComplex) Present ¶
func (n NullComplex) Present() bool
Present determines whether a value has been set
func (*NullComplex) Scan ¶
func (n *NullComplex) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullComplex) Set ¶ added in v1.1.0
func (n *NullComplex) Set(value complex128)
Set saves value into current struct
func (NullComplex) Typ ¶
func (n NullComplex) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullComplex) UnmarshalJSON ¶
func (n *NullComplex) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullComplex) V ¶
func (n NullComplex) V() complex128
V returns value of underlying type if it was set, otherwise default value
func (NullComplex) Valid ¶
func (n NullComplex) Valid() bool
Valid determines whether a value has been valid
type NullComplex64 ¶
NullComplex64 represents an complex64 that may be null.
func Complex64 ¶
func Complex64(from complex128, defaultValue ...complex64) (nv NullComplex64)
Complex64 convert value from complex128 to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Complex64 ¶
func Float32Complex64(from float32, defaultValue ...complex64) (nv NullComplex64)
Float32Complex64 convert value from float32 to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func FloatComplex64 ¶
func FloatComplex64(from float64, defaultValue ...complex64) (nv NullComplex64)
FloatComplex64 convert value from float64 to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func IntComplex64 ¶
func IntComplex64(from int64, defaultValue ...complex64) (nv NullComplex64)
IntComplex64 convert value from int64 to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func NComplex64 ¶
func NComplex64(value complex64) NullComplex64
NComplex64 returns NullComplex64 from complex64
func StringComplex64 ¶
func StringComplex64(from string, defaultValue ...complex64) (nv NullComplex64)
StringComplex64 convert value from string to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func UintComplex64 ¶
func UintComplex64(from uint64, defaultValue ...complex64) (nv NullComplex64)
UintComplex64 convert value from uint64 to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func (NullComplex64) MarshalJSON ¶
func (n NullComplex64) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullComplex64) Present ¶
func (n NullComplex64) Present() bool
Present determines whether a value has been set
func (*NullComplex64) Scan ¶
func (n *NullComplex64) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullComplex64) Set ¶ added in v1.1.0
func (n *NullComplex64) Set(value complex64)
Set saves value into current struct
func (NullComplex64) Typ ¶
func (n NullComplex64) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullComplex64) UnmarshalJSON ¶
func (n *NullComplex64) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullComplex64) V ¶
func (n NullComplex64) V() complex64
V returns value of underlying type if it was set, otherwise default value
func (NullComplex64) Valid ¶
func (n NullComplex64) Valid() bool
Valid determines whether a value has been valid
type NullFloat ¶
NullFloat represents a float64 that may be null.
func Complex64Float64 ¶
Complex64Float64 convert value from complex64 to float64. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexFloat64 ¶
func ComplexFloat64(from complex128, defaultValue ...float64) (nv NullFloat)
ComplexFloat64 convert value from complex128 to float64. Returns value if type can safely converted, otherwise error & default value in result values
func IntFloat ¶
IntFloat convert value from int to float64. Returns value if type can safely converted, otherwise error & default value in result values
func StringFloat ¶
StringFloat convert value from string to float64. Returns value if type can safely converted, otherwise error & default value in result values
func UintFloat ¶
UintFloat convert value from uint to float64. Returns value if type can safely converted, otherwise error & default value in result values
func (NullFloat) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullFloat) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullFloat) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullFloat32 ¶
NullFloat32 represents a float32 that may be null.
func Complex64Float32 ¶
func Complex64Float32(from complex64, defaultValue ...float32) (nv NullFloat32)
Complex64Float32 convert value from complex64 to float32. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexFloat32 ¶
func ComplexFloat32(from complex128, defaultValue ...float32) (nv NullFloat32)
ComplexFloat32 convert value from complex128 to float32. Returns value if type can safely converted, otherwise error & default value in result values
func Float32 ¶
func Float32(from float64, defaultValue ...float32) (nv NullFloat32)
Float32 convert value from float64 to float32. Returns value if type can safely converted, otherwise error & default value in result values
func IntFloat32 ¶
func IntFloat32(from int64, defaultValue ...float32) (nv NullFloat32)
IntFloat32 convert value from int to float32. Returns value if type can safely converted, otherwise error & default value in result values
func StringFloat32 ¶
func StringFloat32(from string, defaultValue ...float32) (nv NullFloat32)
StringFloat32 convert value from string to float32. Returns value if type can safely converted, otherwise error & default value in result values
func UintFloat32 ¶
func UintFloat32(from uint64, defaultValue ...float32) (nv NullFloat32)
UintFloat32 convert value from uint to float32. Returns value if type can safely converted, otherwise error & default value in result values
func (NullFloat32) MarshalJSON ¶
func (n NullFloat32) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullFloat32) Present ¶
func (n NullFloat32) Present() bool
Present determines whether a value has been set
func (*NullFloat32) Scan ¶
func (n *NullFloat32) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullFloat32) Set ¶ added in v1.1.0
func (n *NullFloat32) Set(value float32)
Set saves value into current struct
func (NullFloat32) Typ ¶
func (n NullFloat32) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullFloat32) UnmarshalJSON ¶
func (n *NullFloat32) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullFloat32) V ¶
func (n NullFloat32) V() float32
V returns value of underlying type if it was set, otherwise default value
func (NullFloat32) Valid ¶
func (n NullFloat32) Valid() bool
Valid determines whether a value has been valid
type NullInt ¶
NullInt represents an int that may be null.
func Complex64Int ¶
Complex64Int convert value from complex64 to int. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexInt ¶
func ComplexInt(from complex128, defaultValue ...int) (nv NullInt)
ComplexInt convert value from complex128 to int. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Int ¶
Float32Int convert value from float32 to int. Returns value if type can safely converted, otherwise error & default value in result values
func FloatInt ¶
FloatInt convert value from float64 to int. Returns value if type can safely converted, otherwise error & default value in result values
func StringInt ¶
StringInt convert value from string to int. Returns value if type can safely converted, otherwise error & default value in result values
func (NullInt) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullInt) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInt) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullInt16 ¶
NullInt16 represents an int16 that may be null.
func Complex64Int16 ¶
Complex64Int16 convert value from complex64 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexInt16 ¶
func ComplexInt16(from complex128, defaultValue ...int16) (nv NullInt16)
ComplexInt16 convert value from complex128 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Int16 ¶
Float32Int16 convert value from float32 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func FloatInt16 ¶
FloatInt16 convert value from float64 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func Int16 ¶
Int16 convert value from int64 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func StringInt16 ¶
StringInt16 convert value from string to int16. Returns value if type can safely converted, otherwise error & default value in result values
func UintInt16 ¶
UintInt16 convert value from uint64 to int16. Returns value if type can safely converted, otherwise error & default value in result values
func (NullInt16) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullInt16) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInt16) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullInt32 ¶
NullInt32 represents an int32 that may be null.
func Complex64Int32 ¶
Complex64Int32 convert value from complex64 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexInt32 ¶
func ComplexInt32(from complex128, defaultValue ...int32) (nv NullInt32)
ComplexInt32 convert value from complex128 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Int32 ¶
Float32Int32 convert value from float32 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func FloatInt32 ¶
FloatInt32 convert value from float64 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func Int32 ¶
Int32 convert value from int64 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func StringInt32 ¶
StringInt32 convert value from string to int32. Returns value if type can safely converted, otherwise error & default value in result values
func UintInt32 ¶
UintInt32 convert value from uint64 to int32. Returns value if type can safely converted, otherwise error & default value in result values
func (NullInt32) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullInt32) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInt32) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullInt64 ¶
NullInt64 represents an int64 that may be null.
func Complex64Int64 ¶
Complex64Int64 convert value from complex64 to int64. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexInt64 ¶
func ComplexInt64(from complex128, defaultValue ...int64) (nv NullInt64)
ComplexInt64 convert value from complex128 to int64. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Int64 ¶
Float32Int64 convert value from float32 to int64. Returns value if type can safely converted, otherwise error & default value in result values
func FloatInt64 ¶
FloatInt64 convert value from float64 to int64. Returns value if type can safely converted, otherwise error & default value in result values
func StringInt64 ¶
StringInt64 convert value from string to int64. Returns value if type can safely converted, otherwise error & default value in result values
func UintInt64 ¶
UintInt64 convert value from uint64 to int64. Returns value if type can safely converted, otherwise error & default value in result values
func (NullInt64) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullInt64) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInt64) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullInt8 ¶
NullInt8 represents an int8 that may be null.
func Complex64Int8 ¶
Complex64Int8 convert value from complex64 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexInt8 ¶
func ComplexInt8(from complex128, defaultValue ...int8) (nv NullInt8)
ComplexInt8 convert value from complex128 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Int8 ¶
Float32Int8 convert value from float32 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func FloatInt8 ¶
FloatInt8 convert value from float64 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func Int8 ¶
Int8 convert value from int64 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func StringInt8 ¶
StringInt8 convert value from string to int8. Returns value if type can safely converted, otherwise error & default value in result values
func UintInt8 ¶
UintInt8 convert value from uint64 to int8. Returns value if type can safely converted, otherwise error & default value in result values
func (NullInt8) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullInt8) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInt8) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullInterface ¶
type NullInterface struct { P interface{} Error error }
NullInterface represents an interface{} that may be null.
func NInterface ¶
func NInterface(value interface{}) NullInterface
NInterface returns NullInterface from interface{}
func (NullInterface) MarshalJSON ¶
func (n NullInterface) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullInterface) Present ¶
func (n NullInterface) Present() bool
Present determines whether a value has been set
func (*NullInterface) Scan ¶
func (n *NullInterface) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullInterface) Set ¶ added in v1.1.0
func (n *NullInterface) Set(value interface{})
Set saves value into current struct
func (NullInterface) Typ ¶
func (n NullInterface) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullInterface) UnmarshalJSON ¶
func (n *NullInterface) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullInterface) V ¶
func (n NullInterface) V() interface{}
V returns value of underlying type if it was set, otherwise default value
func (NullInterface) Valid ¶
func (n NullInterface) Valid() bool
Valid determines whether a value has been valid
type NullString ¶
NullString represents a string that may be null.
func BoolString ¶
func BoolString(from bool) (nv NullString)
BoolString convert value from bool to string
func ComplexString ¶
func ComplexString(from complex128, options ...ComplexStringOption) (nv NullString)
ComplexString convert value from complex128 to string
func Concat ¶
func Concat(values []interface{}, options ...Option) NullString
Concat returns concatenated interface values to string
func FloatString ¶
func FloatString(from float64, options ...FloatStringOption) (nv NullString)
FloatString convert value from float to string
func IntString ¶
func IntString(from int64, options ...IntStringOption) (nv NullString)
IntString convert value from int64 to string
func UintString ¶
func UintString(from uint64, options ...UintStringOption) (nv NullString)
UintString convert value from uint64 to string
func (NullString) MarshalJSON ¶
func (n NullString) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullString) Present ¶
func (n NullString) Present() bool
Present determines whether a value has been set
func (*NullString) Scan ¶
func (n *NullString) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullString) Set ¶ added in v1.1.0
func (n *NullString) Set(value string)
Set saves value into current struct
func (NullString) Typ ¶
func (n NullString) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullString) UnmarshalJSON ¶
func (n *NullString) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullString) V ¶
func (n NullString) V() string
V returns value of underlying type if it was set, otherwise default value
func (NullString) Valid ¶
func (n NullString) Valid() bool
Valid determines whether a value has been valid
type NullTime ¶
NullTime represents a time.Time that may be null.
func (NullTime) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullUint ¶
NullUint represents a uint that may be null.
func Complex64Uint ¶
Complex64Uint convert value from complex64 to uint. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexUint ¶
func ComplexUint(from complex128, defaultValue ...uint) (nv NullUint)
ComplexUint convert value from complex128 to uint. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Uint ¶
Float32Uint convert value from float32 to uint. Returns value if type can safely converted, otherwise error & default value in result values
func FloatUint ¶
FloatUint convert value from float64 to uint. Returns value if type can safely converted, otherwise error & default value in result values
func StringUint ¶
StringUint convert value from string to uint. Returns value if type can safely converted, otherwise error & default value in result values
func (NullUint) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullUint) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullUint) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type NullUint16 ¶
NullUint16 represents a uint16 that may be null.
func Complex64Uint16 ¶
func Complex64Uint16(from complex64, defaultValue ...uint16) (nv NullUint16)
Complex64Uint16 convert value from complex64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexUint16 ¶
func ComplexUint16(from complex128, defaultValue ...uint16) (nv NullUint16)
ComplexUint16 convert value from complex128 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Uint16 ¶
func Float32Uint16(from float32, defaultValue ...uint16) (nv NullUint16)
Float32Uint16 convert value from float32 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func FloatUint16 ¶
func FloatUint16(from float64, defaultValue ...uint16) (nv NullUint16)
FloatUint16 convert value from float64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func IntUint16 ¶
func IntUint16(from int64, defaultValue ...uint16) (nv NullUint16)
IntUint16 convert value from int64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func StringUint16 ¶
func StringUint16(from string, defaultValue ...uint16) (nv NullUint16)
StringUint16 convert value from string to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func Uint16 ¶
func Uint16(from uint64, defaultValue ...uint16) (nv NullUint16)
Uint16 convert value from uint64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func (NullUint16) MarshalJSON ¶
func (n NullUint16) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullUint16) Present ¶
func (n NullUint16) Present() bool
Present determines whether a value has been set
func (*NullUint16) Scan ¶
func (n *NullUint16) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullUint16) Set ¶ added in v1.1.0
func (n *NullUint16) Set(value uint16)
Set saves value into current struct
func (NullUint16) Typ ¶
func (n NullUint16) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullUint16) UnmarshalJSON ¶
func (n *NullUint16) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullUint16) V ¶
func (n NullUint16) V() uint16
V returns value of underlying type if it was set, otherwise default value
func (NullUint16) Valid ¶
func (n NullUint16) Valid() bool
Valid determines whether a value has been valid
type NullUint32 ¶
NullUint32 represents a uint32 that may be null.
func Complex64Uint32 ¶
func Complex64Uint32(from complex64, defaultValue ...uint32) (nv NullUint32)
Complex64Uint32 convert value from complex64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexUint32 ¶
func ComplexUint32(from complex128, defaultValue ...uint32) (nv NullUint32)
ComplexUint32 convert value from complex128 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Uint32 ¶
func Float32Uint32(from float32, defaultValue ...uint32) (nv NullUint32)
Float32Uint32 convert value from float32 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func FloatUint32 ¶
func FloatUint32(from float64, defaultValue ...uint32) (nv NullUint32)
FloatUint32 convert value from float64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func IntUint32 ¶
func IntUint32(from int64, defaultValue ...uint32) (nv NullUint32)
IntUint32 convert value from int64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func StringUint32 ¶
func StringUint32(from string, defaultValue ...uint32) (nv NullUint32)
StringUint32 convert value from string to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func Uint32 ¶
func Uint32(from uint64, defaultValue ...uint32) (nv NullUint32)
Uint32 convert value from uint64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func (NullUint32) MarshalJSON ¶
func (n NullUint32) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullUint32) Present ¶
func (n NullUint32) Present() bool
Present determines whether a value has been set
func (*NullUint32) Scan ¶
func (n *NullUint32) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullUint32) Set ¶ added in v1.1.0
func (n *NullUint32) Set(value uint32)
Set saves value into current struct
func (NullUint32) Typ ¶
func (n NullUint32) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullUint32) UnmarshalJSON ¶
func (n *NullUint32) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullUint32) V ¶
func (n NullUint32) V() uint32
V returns value of underlying type if it was set, otherwise default value
func (NullUint32) Valid ¶
func (n NullUint32) Valid() bool
Valid determines whether a value has been valid
type NullUint64 ¶
NullUint64 represents a uint64 that may be null.
func Complex64Uint64 ¶
func Complex64Uint64(from complex64, defaultValue ...uint64) (nv NullUint64)
Complex64Uint64 convert value from complex64 to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexUint64 ¶
func ComplexUint64(from complex128, defaultValue ...uint64) (nv NullUint64)
ComplexUint64 convert value from complex128 to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Uint64 ¶
func Float32Uint64(from float32, defaultValue ...uint64) (nv NullUint64)
Float32Uint64 convert value from float32 to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func FloatUint64 ¶
func FloatUint64(from float64, defaultValue ...uint64) (nv NullUint64)
FloatUint64 convert value from float64 to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func IntUint64 ¶
func IntUint64(from int64, defaultValue ...uint64) (nv NullUint64)
IntUint64 convert value from int64 to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func StringUint64 ¶
func StringUint64(from string, defaultValue ...uint64) (nv NullUint64)
StringUint64 convert value from string to uint64. Returns value if type can safely converted, otherwise error & default value in result values
func (NullUint64) MarshalJSON ¶
func (n NullUint64) MarshalJSON() ([]byte, error)
MarshalJSON implements the json Marshaler interface.
func (NullUint64) Present ¶
func (n NullUint64) Present() bool
Present determines whether a value has been set
func (*NullUint64) Scan ¶
func (n *NullUint64) Scan(value interface{}) error
Scan implements the sql Scanner interface.
func (*NullUint64) Set ¶ added in v1.1.0
func (n *NullUint64) Set(value uint64)
Set saves value into current struct
func (NullUint64) Typ ¶
func (n NullUint64) Typ(options ...Option) *Type
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullUint64) UnmarshalJSON ¶
func (n *NullUint64) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json Unmarshaler interface.
func (NullUint64) V ¶
func (n NullUint64) V() uint64
V returns value of underlying type if it was set, otherwise default value
func (NullUint64) Valid ¶
func (n NullUint64) Valid() bool
Valid determines whether a value has been valid
type NullUint8 ¶
NullUint8 represents a uint8 that may be null.
func Complex64Uint8 ¶
Complex64Uint8 convert value from complex64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func ComplexUint8 ¶
func ComplexUint8(from complex128, defaultValue ...uint8) (nv NullUint8)
ComplexUint8 convert value from complex128 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func Float32Uint8 ¶
Float32Uint8 convert value from float32 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func FloatUint8 ¶
FloatUint8 convert value from float64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func IntUint8 ¶
IntUint8 convert value from int64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func StringUint8 ¶
StringUint8 convert value from string to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func Uint8 ¶
Uint8 convert value from uint64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values
func (NullUint8) MarshalJSON ¶
MarshalJSON implements the json Marshaler interface.
func (NullUint8) Typ ¶
Typ returns new instance with himself value. If current value is invalid, nil *Type returned
func (*NullUint8) UnmarshalJSON ¶
UnmarshalJSON implements the json Unmarshaler interface.
type Option ¶
type Option func(*opts) error
Option is interface function used as argument value for type conversion configuration
func Base ¶
Base set base for int conversion. The base must be 2 <= base <= 36 for digit values >= 10.
func FmtByte ¶
FmtByte set format for float conversion. The format fmt is one of 'b' (-ddddp±ddd, a binary exponent), 'e' (-d.dddde±dd, a decimal exponent), 'E' (-d.ddddE±dd, a decimal exponent), 'f' (-ddd.dddd, no exponent), 'g' ('e' for large exponents, 'f' otherwise), or 'G' ('E' for large exponents, 'f' otherwise).
func Precision ¶
Precision set precision for float conversion. The precision prec controls the number of digits (excluding the exponent) printed by the 'e', 'E', 'f', 'g', and 'G' formats. For 'e', 'E', and 'f' it is the number of digits after the decimal point. For 'g' and 'G' it is the maximum number of significant digits (trailing zeros are removed). The special precision -1 uses the smallest number of digits necessary such that ParseFloat will return f exactly.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type stores all information about underlying value.
func NewType ¶
NewType create a Type instance with value. This function recursive dereference value by a reference if value is a pointer
func Of ¶
Of create type converter from interface value. This function recursive dereference value by a reference if value is a pointer
func (*Type) BoolHumanize ¶
BoolHumanize convert interface value to bool. Returns false for string 'false' in case-insensitive mode or string equals '0', for other types returns true only for positive values
func (*Type) BoolPositive ¶
BoolPositive convert interface value to bool. Returns true only for positive values
func (*Type) Complex ¶
func (t *Type) Complex(defaultValue ...complex128) (nv NullComplex)
Complex convert interface value to complex128 Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Complex64 ¶
func (t *Type) Complex64(defaultValue ...complex64) (nv NullComplex64)
Complex64 convert interface value to complex64. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Equals ¶
Equals determine whether a variable is equals with current "value" (same value, but can have different primitives types) Primitives type is: int, uint, float, complex, bool
func (*Type) Float ¶
Float convert interface value to float64. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Float32 ¶
func (t *Type) Float32(defaultValue ...float32) (nv NullFloat32)
Float32 convert interface value to float32. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Identical ¶
Identical determine whether a variable is identical with current "value" (same type and same value)
func (*Type) Int ¶
Int convert interface value to int. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Int16 ¶
Int16 convert interface value to int16. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Int32 ¶
Int32 convert interface value to int32. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Int64 ¶
Int64 convert interface value to int64. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Int8 ¶
Int8 convert interface value to int8. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Interface ¶
func (t *Type) Interface() (nv NullInterface)
Interface returns value as interface. Returns nil if value can't safely represents as interface
func (*Type) IsBool ¶
IsBool determine whether a value is boolean type If indirect argument specified, real reflect type returned
func (*Type) IsComplex ¶
IsComplex determine whether a value is complex type If indirect argument specified, real reflect type returned
func (*Type) IsComplex128 ¶
IsComplex128 determine whether a value is complex128 type If indirect argument specified, real reflect type returned
func (*Type) IsComplex64 ¶
IsComplex64 determine whether a value is complex64 type If indirect argument specified, real reflect type returned
func (*Type) IsComposite ¶
IsComposite determine whether a value is composite type (array, slice, map) If indirect argument specified, real reflect type returned
func (*Type) IsFloat ¶
IsFloat determine whether a value is float type If indirect argument specified, real reflect type returned
func (*Type) IsFloat32 ¶
IsFloat32 determine whether a value is float32 type If indirect argument specified, real reflect type returned
func (*Type) IsFloat64 ¶
IsFloat64 determine whether a value is float64 type If indirect argument specified, real reflect type returned
func (*Type) IsInt ¶
IsInt determine whether a value is signed integer type If indirect argument specified, real reflect type returned
func (*Type) IsNumeric ¶
IsNumeric determine whether a value is numeric type (int, uint, float, complex) If indirect argument specified, real reflect type returned
func (*Type) IsPointer ¶
IsPointer determine whether a value is pointer type (Ptr, UnsafePointer, Uintptr) If indirect argument specified, real reflect type returned
func (*Type) IsPrimitives ¶
IsPrimitives determine whether a value is primitives type (int, uint, float, complex, bool) If indirect argument specified, real reflect type returned
func (*Type) IsString ¶
IsString determine whether a value is string type If indirect argument specified, real reflect type returned
func (*Type) IsUint ¶
IsUint determine whether a value is unsigned integer type If indirect argument specified, real reflect type returned
func (*Type) Kind ¶
Kind returns reflect type If indirect argument specified, real reflect type returned
func (*Type) OptionBase ¶
OptionBase returns the base for numeric conversion to string
func (*Type) OptionFmtByte ¶
OptionFmtByte returns float format option for float conversion to string
func (*Type) OptionPrecision ¶
OptionPrecision returns float precision for float conversion to string
func (*Type) String ¶
func (t *Type) String() (nv NullString)
String convert interface value to string
func (*Type) StringBool ¶
func (t *Type) StringBool() (nv NullString)
StringBool convert interface value to string represent as bool
func (*Type) StringComplex ¶
func (t *Type) StringComplex(defaultValue ...complex64) (nv NullString)
StringComplex convert interface value to string represent as complex
func (*Type) StringDefault ¶
func (t *Type) StringDefault(defaultValue string) (nv NullString)
StringDefault convert interface value to string with default value if it wasn't converted or it has zero value
func (*Type) StringEmpty ¶
func (t *Type) StringEmpty() (nv NullString)
StringEmpty convert interface value to string and replace zero values to empty string if needed
func (*Type) StringFloat ¶
func (t *Type) StringFloat(defaultValue ...float32) (nv NullString)
StringFloat convert interface value to string represent as float
func (*Type) StringInt ¶
func (t *Type) StringInt() (nv NullString)
StringInt convert interface value to string represents as int
func (*Type) Uint ¶
Uint convert interface value to uint. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Uint16 ¶
func (t *Type) Uint16(defaultValue ...uint16) (nv NullUint16)
Uint16 convert interface value to uint16. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Uint32 ¶
func (t *Type) Uint32(defaultValue ...uint32) (nv NullUint32)
Uint32 convert interface value to uint32. Returns value if type can safely converted, otherwise error & default value in result values
func (*Type) Uint64 ¶
func (t *Type) Uint64(defaultValue ...uint64) (nv NullUint64)
Uint64 convert interface value to uint64. Returns value if type can safely converted, otherwise error & default value in result values
type UintStringOption ¶
type UintStringOption func(*uintStrOpts) error
UintStringOption is interface function used as argument value for type conversion configuration from uint to string
func UintStringBase ¶
func UintStringBase(value int) UintStringOption
UintStringBase set base for uint conversion to string. The base must be 2 <= base <= 36 for digit values >= 10.
func UintStringDefault ¶
func UintStringDefault(value string) UintStringOption
UintStringDefault set default string value for uint conversion to string.