typ

package module
v2.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2021 License: MIT Imports: 12 Imported by: 6

README

Typ

GoDoc Build Status Coverage Status Go Report Card Mentioned in Awesome Go

Typ is a library providing a powerful interface to impressive user experience with conversion and fetching data from built-in types in Golang

Features

  • Safe conversion along built-in types like as bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, complex64, complex128, string
  • Null types for all primitive types with supported interfaces: json.Unmarshaler, json.Marshaler, sql.Scanner, driver.Valuer
  • Value retriever for multidimensional unstructured data from interface
  • Conversion functions present via interface (reflection) and native types for better performance
  • Some humanize string conversion functions

Installation

Use go get to install the latest version of the library.

    go get -u github.com/gurukami/typ

Then include package in your application and enjoy.

    import "github.com/gurukami/typ/v2"

Usage

Of(interface{}) conversion from interface value to built-in type

// typ.Of(v interface{}, options ...Option).{Type}(defaultValue ...{Type})
//
// Where {Type} any of 
//      Bool, 
//      Int, Int8, Int16, Int32, Int64, 
//      Uint, Uint8, Uint16, Uint32, Uint64, 
//      Float32, Float, 
//      Complex64, Complex, 
//      String
//
// All methods for conversion returns {Type}Accessor with helpful methods
//
//      V() - value of type
//      Present() - determines whether a value has been set
//      Valid() - determines whether a value has been valid (without error)
//      Err() error - returns underlying error  
//      Set(value {Type}) - saves value into current struct  
//      Clone() {Type}Accessor - returns new instance of current struct with preserved value & error  
//      
//      Scan(value interface{})         | sql.Scanner
//      Value() (driver.Value, error)   | driver.Valuer
//
//      UnmarshalJSON(b []byte) error   | json.Unmarshaler
//      MarshalJSON() ([]byte, error)   | json.Marshaler

// Valid
nv := typ.Of(3.1415926535, typ.FmtByte('g'), typ.Precision(4)).String()
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: 3.142, Valid: true, Present: true, Error: <nil>

// Not valid
nv = typ.Of(3.1415926535).Int()
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: 3, Valid: false, Present: true, Error: value can't safely convert

Native conversion without reflection when type is know

// For the best performance always use this way if you know about exact type
//
// typ.{FromType}{ToType}(value , [options ...{FromType}{ToType}Option]).V()
// 
// Where {FromType}, {ToType} any of 
//      Bool, 
//      Int, Int8, Int16, Int32, Int64, 
//      Uint, Uint8, Uint16, Uint32, Uint64, 
//      Float32, Float, 
//      Complex64, Complex, 
//      String
//
// All methods for conversion returns {Type}Accessor interface with helpful methods & fields, additional info you can read in example above

// Valid
nv := typ.FloatString(3.1415926535, typ.FloatStringFmtByte('g'), typ.FloatStringPrecision(4))
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: 3.142, Valid: true, Present: true, Error: <nil>

// Not valid
nv = typ.FloatInt(3.1415926535)
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: 3, Valid: false, Present: true, Error: value can't safely convert

Retrieve multidimensional unstructured data from interface

data := map[int]interface{}{
   0: []interface{}{
      0: map[string]int{
         "0": 42,
      },
   },
}

// Instead of do something like this 
//  data[0].([]interface{})[0].(map[string]int)["0”]
//      and not caught a panic
// use this

// Value exists
nv := typ.Of(data).Get(0, 0, "0").Interface()
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: 42, Valid: true, Present: true, Error: <nil>

// Value not exists
nv = typ.Of(data).Get(3, 7, "5").Interface()
fmt.Printf("Value: %v, Valid: %v, Present: %v, Error: %v\n", nv.V(), nv.Valid(), nv.Present(), nv.Error)
// Output: Value: <nil>, Valid: false, Present: false, Error: out of bounds on given data

Rules of safely type conversion along types

From / to Bool Int* String Uint* Float* Complex*
Bool + + + + + +
Int* + + formatting >= 0 24bit or 53bit real, 24bit or 53bit
String parsing parsing + parsing parsing parsing
Uint* + 63bit formatting + 24bit or 53bit 24bit or 53bit
Float* + 24bit or 53bit formatting >= 0, 24bit or 53bit + +
Complex* + real, 24bit or 53bit + >= 0, real, 24bit or 53bit real +

* based on bit size capacity, 8,16,32,64 for Int,Uint; 32,64 for Float,Complex

Donation for amazing goal

I like airplanes and i want to get private pilot licence, and i believe you can help me to make my dream come true :)

>>>>>>>>>> Make a dream come true <<<<<<<<<<

License

The MIT license
Copyright (c) 2019 Gurukami

Documentation

Index

Constants

View Source
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

View Source
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"))
)
View Source
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 BoolSlice

func BoolSlice(null []BoolAccessor, valid bool) []bool

BoolSlice returns slice of bool with filled values from slice of BoolAccessor

func Complex64Slice

func Complex64Slice(null []Complex64Accessor, valid bool) []complex64

Complex64Slice returns slice of complex64 with filled values from slice of Complex64Accessor

func ComplexSlice

func ComplexSlice(null []ComplexAccessor, valid bool) []complex128

ComplexSlice returns slice of complex128 with filled values from slice of ComplexAccessor

func Float32Slice

func Float32Slice(null []Float32Accessor, valid bool) []float32

Float32Slice returns slice of float32 with filled values from slice of Float32Accessor

func FloatSlice

func FloatSlice(null []FloatAccessor, valid bool) []float64

FloatSlice returns slice of float64 with filled values from slice of FloatAccessor

func Int16Slice

func Int16Slice(null []Int16Accessor, valid bool) []int16

Int16Slice returns slice of int16 with filled values from slice of Int16Accessor

func Int32Slice

func Int32Slice(null []Int32Accessor, valid bool) []int32

Int32Slice returns slice of int32 with filled values from slice of Int32Accessor

func Int64Slice

func Int64Slice(null []Int64Accessor, valid bool) []int64

Int64Slice returns slice of int64 with filled values from slice of Int64Accessor

func Int8Slice

func Int8Slice(null []Int8Accessor, valid bool) []int8

Int8Slice returns slice of int8 with filled values from slice of Int8Accessor

func IntSlice

func IntSlice(null []IntAccessor, valid bool) []int

IntSlice returns slice of int with filled values from slice of IntAccessor

func InterfaceSlice

func InterfaceSlice(null []InterfaceAccessor, valid bool) []interface{}

InterfaceSlice returns slice of interface{} with filled values from slice of InterfaceAccessor

func NumericToString

func NumericToString(v interface{}, base int, fmtByte byte, prec int) string

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.

func StringSlice

func StringSlice(null []StringAccessor, valid bool) []string

StringSlice returns slice of string with filled values from slice of StringAccessor

func TimeSlice

func TimeSlice(null []TimeAccessor, valid bool) []time.Time

TimeSlice returns slice of time.Time with filled values from slice of TimeAccessor

func Uint16Slice

func Uint16Slice(null []Uint16Accessor, valid bool) []uint16

Uint16Slice returns slice of uint16 with filled values from slice of Uint16Accessor

func Uint32Slice

func Uint32Slice(null []Uint32Accessor, valid bool) []uint32

Uint32Slice returns slice of uint32 with filled values from slice of Uint32Accessor

func Uint64Slice

func Uint64Slice(null []Uint64Accessor, valid bool) []uint64

Uint64Slice returns slice of uint64 with filled values from slice of Uint64Accessor

func Uint8Slice

func Uint8Slice(null []Uint8Accessor, valid bool) []uint8

Uint8Slice returns slice of uint8 with filled values from slice of Uint8Accessor

func UintSlice

func UintSlice(null []UintAccessor, valid bool) []uint

UintSlice returns slice of uint with filled values from slice of UintAccessor

Types

type BoolAccessor

type BoolAccessor interface {
	Common
	V() bool
	Set(value bool)
	Clone() BoolAccessor
}

BoolAccessor accessor of bool type.

func NBool

func NBool(value bool) BoolAccessor

NBool returns NullBool under BoolAccessor from bool

func NNBool

func NNBool(value bool) BoolAccessor

NNBool returns NotNullBool under BoolAccessor from bool

func StringBoolHumanize

func StringBoolHumanize(from string) BoolAccessor

StringBoolHumanize convert value from string to bool. Returns false for string 'false' in case-insensitive mode or string equals '0'

type BoolCommon

type BoolCommon struct {
	P     *bool
	Error error
}

BoolCommon represents a bool with pointer and error.

func (BoolCommon) Err

func (n BoolCommon) Err() error

Err returns underlying error.

func (BoolCommon) MarshalJSON

func (n BoolCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (BoolCommon) Present

func (n BoolCommon) Present() bool

Present determines whether a value has been set

func (*BoolCommon) Scan

func (n *BoolCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*BoolCommon) Set

func (n *BoolCommon) Set(value bool)

Set saves value into current struct

func (BoolCommon) Typ

func (n BoolCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*BoolCommon) UnmarshalJSON

func (n *BoolCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (BoolCommon) V

func (n BoolCommon) V() bool

V returns value of underlying type if it was set, otherwise default value

func (BoolCommon) Valid

func (n BoolCommon) Valid() bool

Valid determines whether a value has been valid

func (BoolCommon) Value

func (n BoolCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Common

type Common interface {
	Present() bool
	Valid() bool
	Typ(options ...Option) *Type
	Err() error
}

Common general interface of accessor

type Complex64Accessor

type Complex64Accessor interface {
	Common
	V() complex64
	Set(value complex64)
	Clone() Complex64Accessor
}

Complex64Accessor accessor of complex64 type.

func Complex64

func Complex64(from complex128, defaultValue ...complex64) Complex64Accessor

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) Complex64Accessor

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) Complex64Accessor

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) Complex64Accessor

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) Complex64Accessor

NComplex64 returns NullComplex64 under Complex64Accessor from complex64

func NNComplex64

func NNComplex64(value complex64) Complex64Accessor

NNComplex64 returns NotNullComplex64 under Complex64Accessor from complex64

func StringComplex64

func StringComplex64(from string, defaultValue ...complex64) Complex64Accessor

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) Complex64Accessor

UintComplex64 convert value from uint64 to complex64. Returns value if type can safely converted, otherwise error & default value in result values

type Complex64Common

type Complex64Common struct {
	P     *complex64
	Error error
}

Complex64Common represents a complex64 with pointer and error.

func (Complex64Common) Err

func (n Complex64Common) Err() error

Err returns underlying error.

func (Complex64Common) MarshalJSON

func (n Complex64Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Complex64Common) Present

func (n Complex64Common) Present() bool

Present determines whether a value has been set

func (*Complex64Common) Scan

func (n *Complex64Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Complex64Common) Set

func (n *Complex64Common) Set(value complex64)

Set saves value into current struct

func (Complex64Common) Typ

func (n Complex64Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Complex64Common) UnmarshalJSON

func (n *Complex64Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Complex64Common) V

func (n Complex64Common) V() complex64

V returns value of underlying type if it was set, otherwise default value

func (Complex64Common) Valid

func (n Complex64Common) Valid() bool

Valid determines whether a value has been valid

func (Complex64Common) Value

func (n Complex64Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type ComplexAccessor

type ComplexAccessor interface {
	Common
	V() complex128
	Set(value complex128)
	Clone() ComplexAccessor
}

ComplexAccessor accessor of complex128 type.

func IntComplex

func IntComplex(from int64, defaultValue ...complex128) ComplexAccessor

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) ComplexAccessor

NComplex returns NullComplex under ComplexAccessor from complex128

func NNComplex

func NNComplex(value complex128) ComplexAccessor

NNComplex returns NotNullComplex under ComplexAccessor from complex128

func StringComplex

func StringComplex(from string, defaultValue ...complex128) ComplexAccessor

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) ComplexAccessor

UintComplex convert value from uint64 to complex128. Returns value if type can safely converted, otherwise error & default value in result values

type ComplexCommon

type ComplexCommon struct {
	P     *complex128
	Error error
}

ComplexCommon represents a complex128 with pointer and error.

func (ComplexCommon) Err

func (n ComplexCommon) Err() error

Err returns underlying error.

func (ComplexCommon) MarshalJSON

func (n ComplexCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (ComplexCommon) Present

func (n ComplexCommon) Present() bool

Present determines whether a value has been set

func (*ComplexCommon) Scan

func (n *ComplexCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*ComplexCommon) Set

func (n *ComplexCommon) Set(value complex128)

Set saves value into current struct

func (ComplexCommon) Typ

func (n ComplexCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*ComplexCommon) UnmarshalJSON

func (n *ComplexCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (ComplexCommon) V

func (n ComplexCommon) V() complex128

V returns value of underlying type if it was set, otherwise default value

func (ComplexCommon) Valid

func (n ComplexCommon) Valid() bool

Valid determines whether a value has been valid

func (ComplexCommon) Value

func (n ComplexCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

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 ErrorPanic

type ErrorPanic error

ErrorPanic is returned when fatal error is occurred

type ErrorUnexpectedValue

type ErrorUnexpectedValue error

ErrorUnexpectedValue is returned when unexpected value given on data

type Float32Accessor

type Float32Accessor interface {
	Common
	V() float32
	Set(value float32)
	Clone() Float32Accessor
}

Float32Accessor accessor of float32 type.

func Complex64Float32

func Complex64Float32(from complex64, defaultValue ...float32) Float32Accessor

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) Float32Accessor

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) Float32Accessor

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) Float32Accessor

IntFloat32 convert value from int to float32. Returns value if type can safely converted, otherwise error & default value in result values

func NFloat32

func NFloat32(value float32) Float32Accessor

NFloat32 returns NullFloat32 under from float32

func NNFloat32

func NNFloat32(value float32) Float32Accessor

NNFloat32 returns NullFloat32 under Float32Accessor from float32

func StringFloat32

func StringFloat32(from string, defaultValue ...float32) Float32Accessor

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) Float32Accessor

UintFloat32 convert value from uint to float32. Returns value if type can safely converted, otherwise error & default value in result values

type Float32Common

type Float32Common struct {
	P     *float32
	Error error
}

Float32Common represents a float32 that may be null.

func (Float32Common) Err

func (n Float32Common) Err() error

Err returns underlying error.

func (Float32Common) MarshalJSON

func (n Float32Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Float32Common) Present

func (n Float32Common) Present() bool

Present determines whether a value has been set

func (*Float32Common) Scan

func (n *Float32Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Float32Common) Set

func (n *Float32Common) Set(value float32)

Set saves value into current struct

func (Float32Common) Typ

func (n Float32Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Float32Common) UnmarshalJSON

func (n *Float32Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Float32Common) V

func (n Float32Common) V() float32

V returns value of underlying type if it was set, otherwise default value

func (Float32Common) Valid

func (n Float32Common) Valid() bool

Valid determines whether a value has been valid

func (Float32Common) Value

func (n Float32Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type FloatAccessor

type FloatAccessor interface {
	Common
	V() float64
	Set(value float64)
	Clone() FloatAccessor
}

FloatAccessor accessor of float64 type.

func Complex64Float64

func Complex64Float64(from complex64, defaultValue ...float64) FloatAccessor

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) FloatAccessor

ComplexFloat64 convert value from complex128 to float64. Returns value if type can safely converted, otherwise error & default value in result values

func IntFloat

func IntFloat(from int64, defaultValue ...float64) FloatAccessor

IntFloat convert value from int to float64. Returns value if type can safely converted, otherwise error & default value in result values

func NFloat

func NFloat(value float64) FloatAccessor

NFloat returns NullFloat under FloatAccessor from float64

func NNFloat

func NNFloat(value float64) FloatAccessor

NNFloat returns NullFloat under FloatAccessor from float64

func StringFloat

func StringFloat(from string, defaultValue ...float64) FloatAccessor

StringFloat convert value from string to float64. Returns value if type can safely converted, otherwise error & default value in result values

func UintFloat

func UintFloat(from uint64, defaultValue ...float64) FloatAccessor

UintFloat convert value from uint to float64. Returns value if type can safely converted, otherwise error & default value in result values

type FloatCommon

type FloatCommon struct {
	P     *float64
	Error error
}

FloatCommon represents a float64 that may be null.

func (FloatCommon) Err

func (n FloatCommon) Err() error

Err returns underlying error.

func (FloatCommon) MarshalJSON

func (n FloatCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (FloatCommon) Present

func (n FloatCommon) Present() bool

Present determines whether a value has been set

func (*FloatCommon) Scan

func (n *FloatCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*FloatCommon) Set

func (n *FloatCommon) Set(value float64)

Set saves value into current struct

func (FloatCommon) Typ

func (n FloatCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*FloatCommon) UnmarshalJSON

func (n *FloatCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (FloatCommon) V

func (n FloatCommon) V() float64

V returns value of underlying type if it was set, otherwise default value

func (FloatCommon) Valid

func (n FloatCommon) Valid() bool

Valid determines whether a value has been valid

func (FloatCommon) Value

func (n FloatCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

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 Int16Accessor

type Int16Accessor interface {
	Common
	V() int16
	Set(value int16)
	Clone() Int16Accessor
}

Int16Accessor accessor of int16 type.

func Complex64Int16

func Complex64Int16(from complex64, defaultValue ...int16) Int16Accessor

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) Int16Accessor

ComplexInt16 convert value from complex128 to int16. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Int16

func Float32Int16(from float32, defaultValue ...int16) Int16Accessor

Float32Int16 convert value from float32 to int16. Returns value if type can safely converted, otherwise error & default value in result values

func FloatInt16

func FloatInt16(from float64, defaultValue ...int16) Int16Accessor

FloatInt16 convert value from float64 to int16. Returns value if type can safely converted, otherwise error & default value in result values

func Int16

func Int16(from int64, defaultValue ...int16) Int16Accessor

Int16 convert value from int64 to int16. Returns value if type can safely converted, otherwise error & default value in result values

func NInt16

func NInt16(value int16) Int16Accessor

NInt16 returns NullInt16 under Int16Accessor from int16

func NNInt16

func NNInt16(value int16) Int16Accessor

NNInt16 returns NotNullInt16 under Int16Accessor from int16

func StringInt16

func StringInt16(from string, defaultValue ...int16) Int16Accessor

StringInt16 convert value from string to int16. Returns value if type can safely converted, otherwise error & default value in result values

func UintInt16

func UintInt16(from uint64, defaultValue ...int16) Int16Accessor

UintInt16 convert value from uint64 to int16. Returns value if type can safely converted, otherwise error & default value in result values

type Int16Common

type Int16Common struct {
	P     *int16
	Error error
}

Int16Common represents an int16 with pointer and error.

func (Int16Common) Err

func (n Int16Common) Err() error

Err returns underlying error.

func (Int16Common) MarshalJSON

func (n Int16Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Int16Common) Present

func (n Int16Common) Present() bool

Present determines whether a value has been set

func (*Int16Common) Scan

func (n *Int16Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Int16Common) Set

func (n *Int16Common) Set(value int16)

Set saves value into current struct

func (Int16Common) Typ

func (n Int16Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Int16Common) UnmarshalJSON

func (n *Int16Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Int16Common) V

func (n Int16Common) V() int16

V returns value of underlying type if it was set, otherwise default value

func (Int16Common) Valid

func (n Int16Common) Valid() bool

Valid determines whether a value has been valid

func (Int16Common) Value

func (n Int16Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Int32Accessor

type Int32Accessor interface {
	Common
	V() int32
	Set(value int32)
	Clone() Int32Accessor
}

Int32Accessor accessor of int32 type.

func Complex64Int32

func Complex64Int32(from complex64, defaultValue ...int32) Int32Accessor

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) Int32Accessor

ComplexInt32 convert value from complex128 to int32. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Int32

func Float32Int32(from float32, defaultValue ...int32) Int32Accessor

Float32Int32 convert value from float32 to int32. Returns value if type can safely converted, otherwise error & default value in result values

func FloatInt32

func FloatInt32(from float64, defaultValue ...int32) Int32Accessor

FloatInt32 convert value from float64 to int32. Returns value if type can safely converted, otherwise error & default value in result values

func Int32

func Int32(from int64, defaultValue ...int32) Int32Accessor

Int32 convert value from int64 to int32. Returns value if type can safely converted, otherwise error & default value in result values

func NInt32

func NInt32(value int32) Int32Accessor

NInt32 returns NullInt32 under Int32Accessor from int32

func NNInt32

func NNInt32(value int32) Int32Accessor

NNInt32 returns NotNullInt32 under Int32Accessor from int32

func StringInt32

func StringInt32(from string, defaultValue ...int32) Int32Accessor

StringInt32 convert value from string to int32. Returns value if type can safely converted, otherwise error & default value in result values

func UintInt32

func UintInt32(from uint64, defaultValue ...int32) Int32Accessor

UintInt32 convert value from uint64 to int32. Returns value if type can safely converted, otherwise error & default value in result values

type Int32Common

type Int32Common struct {
	P     *int32
	Error error
}

Int32Common represents an int32 with pointer and error.

func (Int32Common) Err

func (n Int32Common) Err() error

Err returns underlying error.

func (Int32Common) MarshalJSON

func (n Int32Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Int32Common) Present

func (n Int32Common) Present() bool

Present determines whether a value has been set

func (*Int32Common) Scan

func (n *Int32Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Int32Common) Set

func (n *Int32Common) Set(value int32)

Set saves value into current struct

func (Int32Common) Typ

func (n Int32Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Int32Common) UnmarshalJSON

func (n *Int32Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Int32Common) V

func (n Int32Common) V() int32

V returns value of underlying type if it was set, otherwise default value

func (Int32Common) Valid

func (n Int32Common) Valid() bool

Valid determines whether a value has been valid

func (Int32Common) Value

func (n Int32Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Int64Accessor

type Int64Accessor interface {
	Common
	V() int64
	Set(value int64)
	Clone() Int64Accessor
}

Int64Accessor accessor of int64 type.

func Complex64Int64

func Complex64Int64(from complex64, defaultValue ...int64) Int64Accessor

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) Int64Accessor

ComplexInt64 convert value from complex128 to int64. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Int64

func Float32Int64(from float32, defaultValue ...int64) Int64Accessor

Float32Int64 convert value from float32 to int64. Returns value if type can safely converted, otherwise error & default value in result values

func FloatInt64

func FloatInt64(from float64, defaultValue ...int64) Int64Accessor

FloatInt64 convert value from float64 to int64. Returns value if type can safely converted, otherwise error & default value in result values

func NInt64

func NInt64(value int64) Int64Accessor

NInt64 returns NullInt64 under Int64Accessor from int64

func NNInt64

func NNInt64(value int64) Int64Accessor

NNInt64 returns NotNullInt64 under from int64

func StringInt64

func StringInt64(from string, defaultValue ...int64) Int64Accessor

StringInt64 convert value from string to int64. Returns value if type can safely converted, otherwise error & default value in result values

func UintInt64

func UintInt64(from uint64, defaultValue ...int64) Int64Accessor

UintInt64 convert value from uint64 to int64. Returns value if type can safely converted, otherwise error & default value in result values

type Int64Common

type Int64Common struct {
	P     *int64
	Error error
}

Int64Common represents an int64 with pointer and error.

func (Int64Common) Err

func (n Int64Common) Err() error

Err returns underlying error.

func (Int64Common) MarshalJSON

func (n Int64Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Int64Common) Present

func (n Int64Common) Present() bool

Present determines whether a value has been set

func (*Int64Common) Scan

func (n *Int64Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Int64Common) Set

func (n *Int64Common) Set(value int64)

Set saves value into current struct

func (Int64Common) Typ

func (n Int64Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Int64Common) UnmarshalJSON

func (n *Int64Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Int64Common) V

func (n Int64Common) V() int64

V returns value of underlying type if it was set, otherwise default value

func (Int64Common) Valid

func (n Int64Common) Valid() bool

Valid determines whether a value has been valid

func (Int64Common) Value

func (n Int64Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Int8Accessor

type Int8Accessor interface {
	Common
	V() int8
	Set(value int8)
	Clone() Int8Accessor
}

Int8Accessor accessor of int8 type.

func Complex64Int8

func Complex64Int8(from complex64, defaultValue ...int8) Int8Accessor

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) Int8Accessor

ComplexInt8 convert value from complex128 to int8. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Int8

func Float32Int8(from float32, defaultValue ...int8) Int8Accessor

Float32Int8 convert value from float32 to int8. Returns value if type can safely converted, otherwise error & default value in result values

func FloatInt8

func FloatInt8(from float64, defaultValue ...int8) Int8Accessor

FloatInt8 convert value from float64 to int8. Returns value if type can safely converted, otherwise error & default value in result values

func Int8

func Int8(from int64, defaultValue ...int8) Int8Accessor

Int8 convert value from int64 to int8. Returns value if type can safely converted, otherwise error & default value in result values

func NInt8

func NInt8(value int8) Int8Accessor

NInt8 returns NullInt8 under Int8Accessor from int8

func NNInt8

func NNInt8(value int8) Int8Accessor

NNInt8 returns NotNullInt8 under Int8Accessor from int8

func StringInt8

func StringInt8(from string, defaultValue ...int8) Int8Accessor

StringInt8 convert value from string to int8. Returns value if type can safely converted, otherwise error & default value in result values

func UintInt8

func UintInt8(from uint64, defaultValue ...int8) Int8Accessor

UintInt8 convert value from uint64 to int8. Returns value if type can safely converted, otherwise error & default value in result values

type Int8Common

type Int8Common struct {
	P     *int8
	Error error
}

Int8Common represents an int8 with pointer and error.

func (Int8Common) Err

func (n Int8Common) Err() error

Err returns underlying error.

func (Int8Common) MarshalJSON

func (n Int8Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Int8Common) Present

func (n Int8Common) Present() bool

Present determines whether a value has been set

func (*Int8Common) Scan

func (n *Int8Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Int8Common) Set

func (n *Int8Common) Set(value int8)

Set saves value into current struct

func (Int8Common) Typ

func (n Int8Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Int8Common) UnmarshalJSON

func (n *Int8Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Int8Common) V

func (n Int8Common) V() int8

V returns value of underlying type if it was set, otherwise default value

func (Int8Common) Valid

func (n Int8Common) Valid() bool

Valid determines whether a value has been valid

func (Int8Common) Value

func (n Int8Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type IntAccessor

type IntAccessor interface {
	Common
	V() int
	Set(value int)
	Clone() IntAccessor
}

IntAccessor accessor of int type.

func Complex64Int

func Complex64Int(from complex64, defaultValue ...int) IntAccessor

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) IntAccessor

ComplexInt convert value from complex128 to int. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Int

func Float32Int(from float32, defaultValue ...int) IntAccessor

Float32Int convert value from float32 to int. Returns value if type can safely converted, otherwise error & default value in result values

func FloatInt

func FloatInt(from float64, defaultValue ...int) IntAccessor

FloatInt convert value from float64 to int. Returns value if type can safely converted, otherwise error & default value in result values

func NInt

func NInt(value int) IntAccessor

NInt returns NullInt under IntAccessor from int

func NNInt

func NNInt(value int) IntAccessor

NNInt returns NotNullInt under IntAccessor from int

func StringInt

func StringInt(from string, defaultValue ...int) IntAccessor

StringInt convert value from string to int. Returns value if type can safely converted, otherwise error & default value in result values

type IntCommon

type IntCommon struct {
	P     *int
	Error error
}

IntCommon represents an int with pointer and error.

func (IntCommon) Err

func (n IntCommon) Err() error

Err returns underlying error.

func (IntCommon) MarshalJSON

func (n IntCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (IntCommon) Present

func (n IntCommon) Present() bool

Present determines whether a value has been set

func (*IntCommon) Scan

func (n *IntCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*IntCommon) Set

func (n *IntCommon) Set(value int)

Set saves value into current struct

func (IntCommon) Typ

func (n IntCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*IntCommon) UnmarshalJSON

func (n *IntCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (IntCommon) V

func (n IntCommon) V() int

V returns value of underlying type if it was set, otherwise default value

func (IntCommon) Valid

func (n IntCommon) Valid() bool

Valid determines whether a value has been valid

func (IntCommon) Value

func (n IntCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

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 InterfaceAccessor

type InterfaceAccessor interface {
	Common
	V() interface{}
	Set(value interface{})
	Clone() InterfaceAccessor
}

InterfaceAccessor accessor of interface{} type.

func NInterface

func NInterface(value interface{}) InterfaceAccessor

NInterface returns NullInterface under InterfaceAccessor from interface{}

func NNInterface

func NNInterface(value interface{}) InterfaceAccessor

NNInterface returns NotNullInterface under InterfaceAccessor from interface{}

type InterfaceCommon

type InterfaceCommon struct {
	P     interface{}
	Error error
}

InterfaceCommon represents an interface{} that may be null.

func (InterfaceCommon) Err

func (n InterfaceCommon) Err() error

Err returns underlying error.

func (InterfaceCommon) MarshalJSON

func (n InterfaceCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (InterfaceCommon) Present

func (n InterfaceCommon) Present() bool

Present determines whether a value has been set

func (*InterfaceCommon) Scan

func (n *InterfaceCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*InterfaceCommon) Set

func (n *InterfaceCommon) Set(value interface{})

Set saves value into current struct

func (InterfaceCommon) Typ

func (n InterfaceCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*InterfaceCommon) UnmarshalJSON

func (n *InterfaceCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (InterfaceCommon) V

func (n InterfaceCommon) V() interface{}

V returns value of underlying type if it was set, otherwise default value

func (InterfaceCommon) Valid

func (n InterfaceCommon) Valid() bool

Valid determines whether a value has been valid

func (InterfaceCommon) Value

func (n InterfaceCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NotNullBool

type NotNullBool struct {
	BoolCommon
}

NotNullBool represents a bool with accessor.

func (NotNullBool) Clone

func (n NotNullBool) Clone() BoolAccessor

Clone returns new instance of NullBool with preserved value & error

type NotNullComplex

type NotNullComplex struct {
	ComplexCommon
}

NotNullComplex represents a complex128 that may be null.

func (NotNullComplex) Clone

func (n NotNullComplex) Clone() ComplexAccessor

Clone returns new instance of NotNullComplex with preserved value & error

type NotNullComplex64

type NotNullComplex64 struct {
	Complex64Common
}

NotNullComplex64 represents a complex64 that may be null.

func (NotNullComplex64) Clone

Clone returns new instance of NotNullComplex64 with preserved value & error

type NotNullFloat

type NotNullFloat struct {
	FloatCommon
}

NotNullFloat represents a float64 that may be null.

func (NotNullFloat) Clone

func (n NotNullFloat) Clone() FloatAccessor

Clone returns new instance of NotNullFloat with preserved value & error

type NotNullFloat32

type NotNullFloat32 struct {
	Float32Common
}

NotNullFloat32 represents a float32 that may be null.

func (NotNullFloat32) Clone

func (n NotNullFloat32) Clone() Float32Accessor

Clone returns new instance of NotNullFloat32 with preserved value & error

type NotNullInt

type NotNullInt struct {
	IntCommon
}

NotNullInt represents an int with accessor.

func (NotNullInt) Clone

func (n NotNullInt) Clone() IntAccessor

Clone returns new instance of NotNullInt with preserved value & error

type NotNullInt16

type NotNullInt16 struct {
	Int16Common
}

NotNullInt16 represents an int16 with accessor.

func (NotNullInt16) Clone

func (n NotNullInt16) Clone() Int16Accessor

Clone returns new instance of NotNullInt16 with preserved value & error

type NotNullInt32

type NotNullInt32 struct {
	Int32Common
}

NotNullInt32 represents an int32 with accessor.

func (NotNullInt32) Clone

func (n NotNullInt32) Clone() Int32Accessor

Clone returns new instance of NotNullInt32 with preserved value & error

type NotNullInt64

type NotNullInt64 struct {
	Int64Common
}

NotNullInt64 represents an int64 with accessor.

func (NotNullInt64) Clone

func (n NotNullInt64) Clone() Int64Accessor

Clone returns new instance of NotNullInt64 with preserved value & error

type NotNullInt8

type NotNullInt8 struct {
	Int8Common
}

NotNullInt8 represents an int8 with accessor.

func (NotNullInt8) Clone

func (n NotNullInt8) Clone() Int8Accessor

Clone returns new instance of NotNullInt8 with preserved value & error

type NotNullInterface

type NotNullInterface struct {
	InterfaceCommon
}

NotNullInterface represents an interface{} that may be null.

func (NotNullInterface) Clone

Clone returns new instance of NotNullInterface with preserved value & error

type NotNullString

type NotNullString struct {
	StringCommon
}

NotNullString represents a string that may be null.

func (NotNullString) Clone

func (n NotNullString) Clone() StringAccessor

Clone returns new instance of NotNullString with preserved value & error

type NotNullTime

type NotNullTime struct {
	TimeCommon
}

NotNullTime represents a time.Time that may be null.

func (NotNullTime) Clone

func (n NotNullTime) Clone() TimeAccessor

Clone returns new instance of NotNullTime with preserved value & error

type NotNullUint

type NotNullUint struct {
	UintCommon
}

NotNullUint represents an uint with accessor.

func (NotNullUint) Clone

func (n NotNullUint) Clone() UintAccessor

Clone returns new instance of NotNullUint with preserved value & error

type NotNullUint16

type NotNullUint16 struct {
	Uint16Common
}

NotNullUint16 represents an uint16 with accessor.

func (NotNullUint16) Clone

func (n NotNullUint16) Clone() Uint16Accessor

Clone returns new instance of NotNullUint16 with preserved value & error

type NotNullUint32

type NotNullUint32 struct {
	Uint32Common
}

NotNullUint32 represents an uint32 with accessor.

func (NotNullUint32) Clone

func (n NotNullUint32) Clone() Uint32Accessor

Clone returns new instance of NotNullUint32 with preserved value & error

type NotNullUint64

type NotNullUint64 struct {
	Uint64Common
}

NotNullUint64 represents an uint64 with accessor.

func (NotNullUint64) Clone

func (n NotNullUint64) Clone() Uint64Accessor

Clone returns new instance of NotNullUint64 with preserved value & error

type NotNullUint8

type NotNullUint8 struct {
	Uint8Common
}

NotNullUint8 represents an uint8 with accessor.

func (NotNullUint8) Clone

func (n NotNullUint8) Clone() Uint8Accessor

Clone returns new instance of NotNullUint8 with preserved value & error

type NullBool

type NullBool struct {
	BoolCommon
}

NullBool represents a bool that may be null.

func (NullBool) Clone

func (n NullBool) Clone() BoolAccessor

Clone returns new instance of NullBool with preserved value & error

func (NullBool) MarshalJSON

func (n NullBool) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullBool) Value

func (n NullBool) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullComplex

type NullComplex struct {
	ComplexCommon
}

NullComplex represents a complex128 that may be null.

func (NullComplex) Clone

func (n NullComplex) Clone() ComplexAccessor

Clone returns new instance of NullComplex with preserved value & error

func (NullComplex) MarshalJSON

func (n NullComplex) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullComplex) Value

func (n NullComplex) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullComplex64

type NullComplex64 struct {
	Complex64Common
}

NullComplex64 represents a complex64 that may be null.

func (NullComplex64) Clone

func (n NullComplex64) Clone() Complex64Accessor

Clone returns new instance of NullComplex64 with preserved value & error

func (NullComplex64) MarshalJSON

func (n NullComplex64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullComplex64) Value

func (n NullComplex64) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullFloat

type NullFloat struct {
	FloatCommon
}

NullFloat represents a float64 that may be null.

func (NullFloat) Clone

func (n NullFloat) Clone() FloatAccessor

Clone returns new instance of NullFloat with preserved value & error

func (NullFloat) MarshalJSON

func (n NullFloat) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullFloat) Value

func (n NullFloat) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullFloat32

type NullFloat32 struct {
	Float32Common
}

NullFloat32 represents a float32 that may be null.

func (NullFloat32) Clone

func (n NullFloat32) Clone() Float32Accessor

Clone returns new instance of NullFloat32 with preserved value & error

func (NullFloat32) MarshalJSON

func (n NullFloat32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullFloat32) Value

func (n NullFloat32) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInt

type NullInt struct {
	IntCommon
}

NullInt represents an int that may be null.

func (NullInt) Clone

func (n NullInt) Clone() IntAccessor

Clone returns new instance of NullInt with preserved value & error

func (NullInt) MarshalJSON

func (n NullInt) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInt) Value

func (n NullInt) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInt16

type NullInt16 struct {
	Int16Common
}

NullInt16 represents an int16 that may be null.

func (NullInt16) Clone

func (n NullInt16) Clone() Int16Accessor

Clone returns new instance of NullInt16 with preserved value & error

func (NullInt16) MarshalJSON

func (n NullInt16) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInt16) Value

func (n NullInt16) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInt32

type NullInt32 struct {
	Int32Common
}

NullInt32 represents an int32 that may be null.

func (NullInt32) Clone

func (n NullInt32) Clone() Int32Accessor

Clone returns new instance of NullInt32 with preserved value & error

func (NullInt32) MarshalJSON

func (n NullInt32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInt32) Value

func (n NullInt32) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInt64

type NullInt64 struct {
	Int64Common
}

NullInt64 represents an int64 that may be null.

func (NullInt64) Clone

func (n NullInt64) Clone() Int64Accessor

Clone returns new instance of NullInt64 with preserved value & error

func (NullInt64) MarshalJSON

func (n NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInt64) Value

func (n NullInt64) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInt8

type NullInt8 struct {
	Int8Common
}

NullInt8 represents an int8 that may be null.

func (NullInt8) Clone

func (n NullInt8) Clone() Int8Accessor

Clone returns new instance of NullInt8 with preserved value & error

func (NullInt8) MarshalJSON

func (n NullInt8) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInt8) Value

func (n NullInt8) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullInterface

type NullInterface struct {
	InterfaceCommon
}

NullInterface represents an interface{} that may be null.

func (NullInterface) Clone

func (n NullInterface) Clone() InterfaceAccessor

Clone returns new instance of NullInterface with preserved value & error

func (NullInterface) MarshalJSON

func (n NullInterface) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullInterface) Value

func (n NullInterface) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullString

type NullString struct {
	StringCommon
}

NullString represents a string that may be null.

func (NullString) Clone

func (n NullString) Clone() StringAccessor

Clone returns new instance of NullString with preserved value & error

func (NullString) MarshalJSON

func (n NullString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullString) Value

func (n NullString) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullTime

type NullTime struct {
	TimeCommon
}

NullTime represents a time.Time that may be null.

func (NullTime) Clone

func (n NullTime) Clone() TimeAccessor

Clone returns new instance of NullTime with preserved value & error

func (NullTime) MarshalJSON

func (n NullTime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullTime) Value

func (n NullTime) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullUint

type NullUint struct {
	UintCommon
}

NullUint represents an uint that may be null.

func (NullUint) Clone

func (n NullUint) Clone() UintAccessor

Clone returns new instance of NullUint with preserved value & error

func (NullUint) MarshalJSON

func (n NullUint) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullUint) Value

func (n NullUint) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullUint16

type NullUint16 struct {
	Uint16Common
}

NullUint16 represents an uint16 that may be null.

func (NullUint16) Clone

func (n NullUint16) Clone() Uint16Accessor

Clone returns new instance of NullUint16 with preserved value & error

func (NullUint16) MarshalJSON

func (n NullUint16) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullUint16) Value

func (n NullUint16) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullUint32

type NullUint32 struct {
	Uint32Common
}

NullUint32 represents an uint32 that may be null.

func (NullUint32) Clone

func (n NullUint32) Clone() Uint32Accessor

Clone returns new instance of NullUint32 with preserved value & error

func (NullUint32) MarshalJSON

func (n NullUint32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullUint32) Value

func (n NullUint32) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullUint64

type NullUint64 struct {
	Uint64Common
}

NullUint64 represents an uint64 that may be null.

func (NullUint64) Clone

func (n NullUint64) Clone() Uint64Accessor

Clone returns new instance of NullUint64 with preserved value & error

func (NullUint64) MarshalJSON

func (n NullUint64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullUint64) Value

func (n NullUint64) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type NullUint8

type NullUint8 struct {
	Uint8Common
}

NullUint8 represents an uint8 that may be null.

func (NullUint8) Clone

func (n NullUint8) Clone() Uint8Accessor

Clone returns new instance of NullUint8 with preserved value & error

func (NullUint8) MarshalJSON

func (n NullUint8) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (NullUint8) Value

func (n NullUint8) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Option

type Option func(*opts) error

Option is interface function used as argument value for type conversion configuration

func Base

func Base(value int) Option

Base set base for int conversion. The base must be 2 <= base <= 36 for digit values >= 10.

func Delimiter

func Delimiter(value string) Option

Delimiter set delimiter for string manipulation

func FmtByte

func FmtByte(value byte) Option

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

func Precision(value int) Option

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.

func Prefix

func Prefix(value string) Option

Prefix set prefix for string manipulation

func Suffix

func Suffix(value string) Option

Suffix set suffix for string manipulation

type StringAccessor

type StringAccessor interface {
	Common
	V() string
	Set(value string)
	Clone() StringAccessor
}

StringAccessor accessor of string type.

func BoolString

func BoolString(from bool) StringAccessor

BoolString convert value from bool to string

func ComplexString

func ComplexString(from complex128, options ...ComplexStringOption) StringAccessor

ComplexString convert value from complex128 to string

func Concat

func Concat(values []interface{}, options ...Option) StringAccessor

Concat returns concatenated interface values to string

func FloatString

func FloatString(from float64, options ...FloatStringOption) StringAccessor

FloatString convert value from float to string

func IntString

func IntString(from int64, options ...IntStringOption) StringAccessor

IntString convert value from int64 to string

func NNString

func NNString(value string) StringAccessor

NNString returns NullString under StringAccessor from string

func NString

func NString(value string) StringAccessor

NString returns NullString under StringAccessor from string

func UintString

func UintString(from uint64, options ...UintStringOption) StringAccessor

UintString convert value from uint64 to string

type StringCommon

type StringCommon struct {
	P     *string
	Error error
}

StringCommon represents a string that may be null.

func (StringCommon) Err

func (n StringCommon) Err() error

Err returns underlying error.

func (StringCommon) MarshalJSON

func (n StringCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (StringCommon) Present

func (n StringCommon) Present() bool

Present determines whether a value has been set

func (*StringCommon) Scan

func (n *StringCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*StringCommon) Set

func (n *StringCommon) Set(value string)

Set saves value into current struct

func (StringCommon) Typ

func (n StringCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*StringCommon) UnmarshalJSON

func (n *StringCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (StringCommon) V

func (n StringCommon) V() string

V returns value of underlying type if it was set, otherwise default value

func (StringCommon) Valid

func (n StringCommon) Valid() bool

Valid determines whether a value has been valid

func (StringCommon) Value

func (n StringCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type TimeAccessor

type TimeAccessor interface {
	Common
	V() time.Time
	Set(value time.Time)
	Clone() TimeAccessor
}

TimeAccessor accessor of time.Time type.

func NNTime

func NNTime(value time.Time) TimeAccessor

NNTime returns NullTime under TimeAccessor from time.Time

func NTime

func NTime(value time.Time) TimeAccessor

NTime returns NullTime under TimeAccessor from time.Time

type TimeCommon

type TimeCommon struct {
	P     *time.Time
	Error error
}

TimeCommon represents a time.Time that may be null.

func (TimeCommon) Err

func (n TimeCommon) Err() error

Err returns underlying error.

func (TimeCommon) MarshalJSON

func (n TimeCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (TimeCommon) Present

func (n TimeCommon) Present() bool

Present determines whether a value has been set

func (*TimeCommon) Scan

func (n *TimeCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*TimeCommon) Set

func (n *TimeCommon) Set(value time.Time)

Set saves value into current struct

func (TimeCommon) Typ

func (n TimeCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*TimeCommon) UnmarshalJSON

func (n *TimeCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (TimeCommon) V

func (n TimeCommon) V() time.Time

V returns value of underlying type if it was set, otherwise default value

func (TimeCommon) Valid

func (n TimeCommon) Valid() bool

Valid determines whether a value has been valid

func (TimeCommon) Value

func (n TimeCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type stores all information about underlying value.

func NewType

func NewType(value interface{}, err error, options ...Option) *Type

NewType create a Type instance with value. This function recursive dereference value by a reference if value is a pointer

func Of

func Of(value interface{}, options ...Option) *Type

Of create type converter from interface value. This function recursive dereference value by a reference if value is a pointer

func (*Type) Bool

func (t *Type) Bool() BoolAccessor

Bool convert interface value to bool. Returns true for any non-zero values

func (*Type) BoolHumanize

func (t *Type) BoolHumanize() BoolAccessor

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

func (t *Type) BoolPositive() BoolAccessor

BoolPositive convert interface value to bool. Returns true only for positive values

func (*Type) Complex

func (t *Type) Complex(defaultValue ...complex128) ComplexAccessor

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) Complex64Accessor

Complex64 convert interface value to complex64. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Empty

func (t *Type) Empty() BoolAccessor

Empty determine whether a variable is zero

func (*Type) Equals

func (t *Type) Equals(value interface{}) BoolAccessor

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) Error

func (t *Type) Error() error

Error returns Underlying error.

func (*Type) Float

func (t *Type) Float(defaultValue ...float64) FloatAccessor

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) Float32Accessor

Float32 convert interface value to float32. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Get

func (t *Type) Get(argIndexes ...interface{}) (typ *Type)

Get retrieve value from composite type, argument values used as index keys

func (*Type) Identical

func (t *Type) Identical(src interface{}) BoolAccessor

Identical determine whether a variable is identical with current "value" (same type and same value)

func (*Type) Int

func (t *Type) Int(defaultValue ...int) IntAccessor

Int convert interface value to int. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Int16

func (t *Type) Int16(defaultValue ...int16) Int16Accessor

Int16 convert interface value to int16. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Int32

func (t *Type) Int32(defaultValue ...int32) Int32Accessor

Int32 convert interface value to int32. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Int64

func (t *Type) Int64(defaultValue ...int64) Int64Accessor

Int64 convert interface value to int64. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Int8

func (t *Type) Int8(defaultValue ...int8) Int8Accessor

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() InterfaceAccessor

Interface returns value as interface. Returns nil if value can't safely represents as interface

func (*Type) IsBool

func (t *Type) IsBool(indirect ...bool) bool

IsBool determine whether a value is boolean type If indirect argument specified, real reflect type returned

func (*Type) IsComplex

func (t *Type) IsComplex(indirect ...bool) bool

IsComplex determine whether a value is complex type If indirect argument specified, real reflect type returned

func (*Type) IsComplex128

func (t *Type) IsComplex128(indirect ...bool) bool

IsComplex128 determine whether a value is complex128 type If indirect argument specified, real reflect type returned

func (*Type) IsComplex64

func (t *Type) IsComplex64(indirect ...bool) bool

IsComplex64 determine whether a value is complex64 type If indirect argument specified, real reflect type returned

func (*Type) IsComposite

func (t *Type) IsComposite(indirect ...bool) bool

IsComposite determine whether a value is composite type (array, slice, map) If indirect argument specified, real reflect type returned

func (*Type) IsFloat

func (t *Type) IsFloat(indirect ...bool) bool

IsFloat determine whether a value is float type If indirect argument specified, real reflect type returned

func (*Type) IsFloat32

func (t *Type) IsFloat32(indirect ...bool) bool

IsFloat32 determine whether a value is float32 type If indirect argument specified, real reflect type returned

func (*Type) IsFloat64

func (t *Type) IsFloat64(indirect ...bool) bool

IsFloat64 determine whether a value is float64 type If indirect argument specified, real reflect type returned

func (*Type) IsInt

func (t *Type) IsInt(indirect ...bool) bool

IsInt determine whether a value is signed integer type If indirect argument specified, real reflect type returned

func (*Type) IsNumeric

func (t *Type) IsNumeric(indirect ...bool) bool

IsNumeric determine whether a value is numeric type (int, uint, float, complex) If indirect argument specified, real reflect type returned

func (*Type) IsPointer

func (t *Type) IsPointer(indirect ...bool) bool

IsPointer determine whether a value is pointer type (Ptr, UnsafePointer, Uintptr) If indirect argument specified, real reflect type returned

func (*Type) IsPrimitives

func (t *Type) IsPrimitives(indirect ...bool) bool

IsPrimitives determine whether a value is primitives type (int, uint, float, complex, bool) If indirect argument specified, real reflect type returned

func (*Type) IsString

func (t *Type) IsString(indirect ...bool) bool

IsString determine whether a value is string type If indirect argument specified, real reflect type returned

func (*Type) IsUint

func (t *Type) IsUint(indirect ...bool) bool

IsUint determine whether a value is unsigned integer type If indirect argument specified, real reflect type returned

func (*Type) Kind

func (t *Type) Kind(indirect ...bool) reflect.Kind

Kind returns reflect type If indirect argument specified, real reflect type returned

func (*Type) OptionBase

func (t *Type) OptionBase() int

OptionBase returns the base for numeric conversion to string

func (*Type) OptionFmtByte

func (t *Type) OptionFmtByte() byte

OptionFmtByte returns float format option for float conversion to string

func (*Type) OptionPrecision

func (t *Type) OptionPrecision() int

OptionPrecision returns float precision for float conversion to string

func (*Type) String

func (t *Type) String() StringAccessor

String convert interface value to string

func (*Type) StringBool

func (t *Type) StringBool() StringAccessor

StringBool convert interface value to string represent as bool

func (*Type) StringComplex

func (t *Type) StringComplex(defaultValue ...complex64) StringAccessor

StringComplex convert interface value to string represent as complex

func (*Type) StringDefault

func (t *Type) StringDefault(defaultValue string) StringAccessor

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() StringAccessor

StringEmpty convert interface value to string and replace zero values to empty string if needed

func (*Type) StringFloat

func (t *Type) StringFloat(defaultValue ...float32) StringAccessor

StringFloat convert interface value to string represent as float

func (*Type) StringInt

func (t *Type) StringInt() StringAccessor

StringInt convert interface value to string represents as int

func (*Type) Uint

func (t *Type) Uint(defaultValue ...uint) UintAccessor

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) Uint16Accessor

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) Uint32Accessor

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) Uint64Accessor

Uint64 convert interface value to uint64. Returns value if type can safely converted, otherwise error & default value in result values

func (*Type) Uint8

func (t *Type) Uint8(defaultValue ...uint8) Uint8Accessor

Uint8 convert interface value to uint8. Returns value if type can safely converted, otherwise error & default value in result values

type Uint16Accessor

type Uint16Accessor interface {
	Common
	V() uint16
	Set(value uint16)
	Clone() Uint16Accessor
}

Uint16Accessor accessor of uint16 type.

func Complex64Uint16

func Complex64Uint16(from complex64, defaultValue ...uint16) Uint16Accessor

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) Uint16Accessor

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) Uint16Accessor

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) Uint16Accessor

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) Uint16Accessor

IntUint16 convert value from int64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values

func NNUint16

func NNUint16(value uint16) Uint16Accessor

NNUint16 returns NotNullUint16 under Uint16Accessor from uint16

func NUint16

func NUint16(value uint16) Uint16Accessor

NUint16 returns NullUint16 under Uint16Accessor from uint16

func StringUint16

func StringUint16(from string, defaultValue ...uint16) Uint16Accessor

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) Uint16Accessor

Uint16 convert value from uint64 to uint16. Returns value if type can safely converted, otherwise error & default value in result values

type Uint16Common

type Uint16Common struct {
	P     *uint16
	Error error
}

Uint16Common represents an uint16 with pointer and error.

func (Uint16Common) Err

func (n Uint16Common) Err() error

Err returns underlying error.

func (Uint16Common) MarshalJSON

func (n Uint16Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Uint16Common) Present

func (n Uint16Common) Present() bool

Present determines whether a value has been set

func (*Uint16Common) Scan

func (n *Uint16Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Uint16Common) Set

func (n *Uint16Common) Set(value uint16)

Set saves value into current struct

func (Uint16Common) Typ

func (n Uint16Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Uint16Common) UnmarshalJSON

func (n *Uint16Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Uint16Common) V

func (n Uint16Common) V() uint16

V returns value of underlying type if it was set, otherwise default value

func (Uint16Common) Valid

func (n Uint16Common) Valid() bool

Valid determines whether a value has been valid

func (Uint16Common) Value

func (n Uint16Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Uint32Accessor

type Uint32Accessor interface {
	Common
	V() uint32
	Set(value uint32)
	Clone() Uint32Accessor
}

Uint32Accessor accessor of uint32 type.

func Complex64Uint32

func Complex64Uint32(from complex64, defaultValue ...uint32) Uint32Accessor

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) Uint32Accessor

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) Uint32Accessor

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) Uint32Accessor

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) Uint32Accessor

IntUint32 convert value from int64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values

func NNUint32

func NNUint32(value uint32) Uint32Accessor

NNUint32 returns NotNullUint32 under Uint32Accessor from uint32

func NUint32

func NUint32(value uint32) Uint32Accessor

NUint32 returns NullUint32 under Uint32Accessor from uint32

func StringUint32

func StringUint32(from string, defaultValue ...uint32) Uint32Accessor

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) Uint32Accessor

Uint32 convert value from uint64 to uint32. Returns value if type can safely converted, otherwise error & default value in result values

type Uint32Common

type Uint32Common struct {
	P     *uint32
	Error error
}

Uint32Common represents an uint32 with pointer and error.

func (Uint32Common) Err

func (n Uint32Common) Err() error

Err returns underlying error.

func (Uint32Common) MarshalJSON

func (n Uint32Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Uint32Common) Present

func (n Uint32Common) Present() bool

Present determines whether a value has been set

func (*Uint32Common) Scan

func (n *Uint32Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Uint32Common) Set

func (n *Uint32Common) Set(value uint32)

Set saves value into current struct

func (Uint32Common) Typ

func (n Uint32Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Uint32Common) UnmarshalJSON

func (n *Uint32Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Uint32Common) V

func (n Uint32Common) V() uint32

V returns value of underlying type if it was set, otherwise default value

func (Uint32Common) Valid

func (n Uint32Common) Valid() bool

Valid determines whether a value has been valid

func (Uint32Common) Value

func (n Uint32Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Uint64Accessor

type Uint64Accessor interface {
	Common
	V() uint64
	Set(value uint64)
	Clone() Uint64Accessor
}

Uint64Accessor accessor of uint64 type.

func Complex64Uint64

func Complex64Uint64(from complex64, defaultValue ...uint64) Uint64Accessor

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) Uint64Accessor

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) Uint64Accessor

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) Uint64Accessor

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) Uint64Accessor

IntUint64 convert value from int64 to uint64. Returns value if type can safely converted, otherwise error & default value in result values

func NNUint64

func NNUint64(value uint64) Uint64Accessor

NNUint64 returns NotNullUint64 under Uint64Accessor from uint64

func NUint64

func NUint64(value uint64) Uint64Accessor

NUint64 returns NullUint64 under Uint64Accessor from uint64

func StringUint64

func StringUint64(from string, defaultValue ...uint64) Uint64Accessor

StringUint64 convert value from string to uint64. Returns value if type can safely converted, otherwise error & default value in result values

type Uint64Common

type Uint64Common struct {
	P     *uint64
	Error error
}

Uint64Common represents an uint64 with pointer and error.

func (Uint64Common) Err

func (n Uint64Common) Err() error

Err returns underlying error.

func (Uint64Common) MarshalJSON

func (n Uint64Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Uint64Common) Present

func (n Uint64Common) Present() bool

Present determines whether a value has been set

func (*Uint64Common) Scan

func (n *Uint64Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Uint64Common) Set

func (n *Uint64Common) Set(value uint64)

Set saves value into current struct

func (Uint64Common) Typ

func (n Uint64Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Uint64Common) UnmarshalJSON

func (n *Uint64Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Uint64Common) V

func (n Uint64Common) V() uint64

V returns value of underlying type if it was set, otherwise default value

func (Uint64Common) Valid

func (n Uint64Common) Valid() bool

Valid determines whether a value has been valid

func (Uint64Common) Value

func (n Uint64Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type Uint8Accessor

type Uint8Accessor interface {
	Common
	V() uint8
	Set(value uint8)
	Clone() Uint8Accessor
}

Uint8Accessor accessor of uint8 type.

func Complex64Uint8

func Complex64Uint8(from complex64, defaultValue ...uint8) Uint8Accessor

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) Uint8Accessor

ComplexUint8 convert value from complex128 to uint8. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Uint8

func Float32Uint8(from float32, defaultValue ...uint8) Uint8Accessor

Float32Uint8 convert value from float32 to uint8. Returns value if type can safely converted, otherwise error & default value in result values

func FloatUint8

func FloatUint8(from float64, defaultValue ...uint8) Uint8Accessor

FloatUint8 convert value from float64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values

func IntUint8

func IntUint8(from int64, defaultValue ...uint8) Uint8Accessor

IntUint8 convert value from int64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values

func NNUint8

func NNUint8(value uint8) Uint8Accessor

NNUint8 returns NotNullUint8 under Uint8Accessor from uint8

func NUint8

func NUint8(value uint8) Uint8Accessor

NUint8 returns NullUint8 under Uint8Accessor from uint8

func StringUint8

func StringUint8(from string, defaultValue ...uint8) Uint8Accessor

StringUint8 convert value from string to uint8. Returns value if type can safely converted, otherwise error & default value in result values

func Uint8

func Uint8(from uint64, defaultValue ...uint8) Uint8Accessor

Uint8 convert value from uint64 to uint8. Returns value if type can safely converted, otherwise error & default value in result values

type Uint8Common

type Uint8Common struct {
	P     *uint8
	Error error
}

Uint8Common represents an uint8 with pointer and error.

func (Uint8Common) Err

func (n Uint8Common) Err() error

Err returns underlying error.

func (Uint8Common) MarshalJSON

func (n Uint8Common) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (Uint8Common) Present

func (n Uint8Common) Present() bool

Present determines whether a value has been set

func (*Uint8Common) Scan

func (n *Uint8Common) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*Uint8Common) Set

func (n *Uint8Common) Set(value uint8)

Set saves value into current struct

func (Uint8Common) Typ

func (n Uint8Common) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*Uint8Common) UnmarshalJSON

func (n *Uint8Common) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (Uint8Common) V

func (n Uint8Common) V() uint8

V returns value of underlying type if it was set, otherwise default value

func (Uint8Common) Valid

func (n Uint8Common) Valid() bool

Valid determines whether a value has been valid

func (Uint8Common) Value

func (n Uint8Common) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

type UintAccessor

type UintAccessor interface {
	Common
	V() uint
	Set(value uint)
	Clone() UintAccessor
}

UintAccessor accessor of uint type.

func Complex64Uint

func Complex64Uint(from complex64, defaultValue ...uint) UintAccessor

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) UintAccessor

ComplexUint convert value from complex128 to uint. Returns value if type can safely converted, otherwise error & default value in result values

func Float32Uint

func Float32Uint(from float32, defaultValue ...uint) UintAccessor

Float32Uint convert value from float32 to uint. Returns value if type can safely converted, otherwise error & default value in result values

func FloatUint

func FloatUint(from float64, defaultValue ...uint) UintAccessor

FloatUint convert value from float64 to uint. Returns value if type can safely converted, otherwise error & default value in result values

func NNUint

func NNUint(value uint) UintAccessor

NNUint returns NotNullUint under UintAccessor from uint

func NUint

func NUint(value uint) UintAccessor

NUint returns NullUint under UintAccessor from uint

func StringUint

func StringUint(from string, defaultValue ...uint) UintAccessor

StringUint convert value from string to uint. Returns value if type can safely converted, otherwise error & default value in result values

type UintCommon

type UintCommon struct {
	P     *uint
	Error error
}

UintCommon represents an uint with pointer and error.

func (UintCommon) Err

func (n UintCommon) Err() error

Err returns underlying error.

func (UintCommon) MarshalJSON

func (n UintCommon) MarshalJSON() ([]byte, error)

MarshalJSON implements the json Marshaler interface.

func (UintCommon) Present

func (n UintCommon) Present() bool

Present determines whether a value has been set

func (*UintCommon) Scan

func (n *UintCommon) Scan(value interface{}) error

Scan implements the sql Scanner interface.

func (*UintCommon) Set

func (n *UintCommon) Set(value uint)

Set saves value into current struct

func (UintCommon) Typ

func (n UintCommon) Typ(options ...Option) *Type

Typ returns new instance with himself value. If current value is invalid, nil *Type returned

func (*UintCommon) UnmarshalJSON

func (n *UintCommon) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json Unmarshaler interface.

func (UintCommon) V

func (n UintCommon) V() uint

V returns value of underlying type if it was set, otherwise default value

func (UintCommon) Valid

func (n UintCommon) Valid() bool

Valid determines whether a value has been valid

func (UintCommon) Value

func (n UintCommon) Value() (driver.Value, error)

Value implements the sql driver Valuer interface.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL