Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayNumberDecode[T Number](data any, begin, end byte) (result []T, err error)
- func ArrayNumberEncode[T Number](begin, end byte, arr []T) *bytes.Buffer
- type Char
- type Duration
- func (d Duration) Abs() Duration
- func (d Duration) Duration() time.Duration
- func (d Duration) Hours() float64
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) Microseconds() int64
- func (d Duration) Milliseconds() int64
- func (d Duration) Minutes() float64
- func (d Duration) Nanoseconds() int64
- func (d Duration) Round(m Duration) Duration
- func (d *Duration) Scan(value any) error
- func (d Duration) Seconds() float64
- func (d Duration) String() string
- func (d Duration) Truncate(m Duration) Duration
- func (d *Duration) UnmarshalJSON(data []byte) error
- func (d Duration) Value() (driver.Value, error)
- type JSON
- func (f *JSON[T]) DecodeValue(v any) error
- func (f JSON[T]) MarshalJSON() ([]byte, error)
- func (f *JSON[T]) Scan(value any) error
- func (f *JSON[T]) SetValue(value any) error
- func (f *JSON[T]) String() string
- func (f *JSON[T]) UnmarshalJSON(data []byte) error
- func (f JSON[T]) Value() (_ driver.Value, err error)
- type NullableJSON
- func (f *NullableJSON[T]) DecodeValue(v any) error
- func (f NullableJSON[T]) MarshalJSON() ([]byte, error)
- func (f *NullableJSON[T]) Scan(value any) error
- func (f *NullableJSON[T]) SetValue(value any) error
- func (f *NullableJSON[T]) String() string
- func (f *NullableJSON[T]) UnmarshalJSON(data []byte) error
- func (f NullableJSON[T]) Value() (_ driver.Value, err error)
- type NullableNumberArray
- func (f *NullableNumberArray[T]) DecodeValue(v interface{}) error
- func (f NullableNumberArray[T]) Filter(fn func(v T) bool) NullableNumberArray[T]
- func (f NullableNumberArray[T]) IndexOf(v T) int
- func (s NullableNumberArray[T]) Len() int
- func (s NullableNumberArray[T]) Less(i, j int) bool
- func (f NullableNumberArray[T]) Map(fn func(v T) (T, bool)) NullableNumberArray[T]
- func (f NullableNumberArray[T]) MarshalJSON() ([]byte, error)
- func (f NullableNumberArray[T]) OneOf(vals []T) bool
- func (f NullableNumberArray[T]) Ordered() NullableOrderedNumberArray[T]
- func (f *NullableNumberArray[T]) Scan(value interface{}) error
- func (f NullableNumberArray[T]) Sort() NullableNumberArray[T]
- func (s NullableNumberArray[T]) Swap(i, j int)
- func (f *NullableNumberArray[T]) UnmarshalJSON(b []byte) error
- func (f NullableNumberArray[T]) Value() (driver.Value, error)
- type NullableOrderedNumberArray
- func (f *NullableOrderedNumberArray[T]) DecodeValue(v interface{}) error
- func (f NullableOrderedNumberArray[T]) Filter(fn func(v T) bool) NullableOrderedNumberArray[T]
- func (f NullableOrderedNumberArray[T]) IndexOf(v T) int
- func (s NullableOrderedNumberArray[T]) Len() int
- func (s NullableOrderedNumberArray[T]) Less(i, j int) bool
- func (f NullableOrderedNumberArray[T]) Map(fn func(v T) (T, bool)) NullableOrderedNumberArray[T]
- func (f NullableOrderedNumberArray[T]) MarshalJSON() ([]byte, error)
- func (f NullableOrderedNumberArray[T]) OneOf(vals []T) bool
- func (f *NullableOrderedNumberArray[T]) Scan(value interface{}) error
- func (f NullableOrderedNumberArray[T]) Sort() NullableOrderedNumberArray[T]
- func (s NullableOrderedNumberArray[T]) Swap(i, j int)
- func (f *NullableOrderedNumberArray[T]) UnmarshalJSON(b []byte) error
- func (f NullableOrderedNumberArray[T]) Value() (driver.Value, error)
- type NullableStringArray
- func (f *NullableStringArray) DecodeValue(v interface{}) error
- func (f NullableStringArray) IndexOf(v string) int
- func (f NullableStringArray) Join(sep string) string
- func (f NullableStringArray) Len() int
- func (f NullableStringArray) MarshalJSON() ([]byte, error)
- func (f NullableStringArray) OneOf(vals []string) bool
- func (f *NullableStringArray) Scan(value interface{}) error
- func (f *NullableStringArray) SetArray(arr []string) *NullableStringArray
- func (f *NullableStringArray) UnmarshalJSON(b []byte) error
- func (f NullableStringArray) Value() (driver.Value, error)
- type Number
- type NumberArray
- func (f *NumberArray[T]) DecodeValue(v interface{}) error
- func (f NumberArray[T]) Filter(fn func(v T) bool) NumberArray[T]
- func (f NumberArray[T]) IndexOf(v T) int
- func (s NumberArray[T]) Len() int
- func (s NumberArray[T]) Less(i, j int) bool
- func (f NumberArray[T]) Map(fn func(v T) (T, bool)) NumberArray[T]
- func (f NumberArray[T]) MarshalJSON() ([]byte, error)
- func (f NumberArray[T]) OneOf(vals []T) bool
- func (f NumberArray[T]) Ordered() OrderedNumberArray[T]
- func (f *NumberArray[T]) Scan(value interface{}) error
- func (f NumberArray[T]) Sort() NumberArray[T]
- func (s NumberArray[T]) Swap(i, j int)
- func (f *NumberArray[T]) UnmarshalJSON(b []byte) error
- func (f NumberArray[T]) Value() (driver.Value, error)
- type OrderedNumberArray
- func (f *OrderedNumberArray[T]) DecodeValue(v interface{}) error
- func (f OrderedNumberArray[T]) Filter(fn func(v T) bool) OrderedNumberArray[T]
- func (f OrderedNumberArray[T]) IndexOf(v T) int
- func (s OrderedNumberArray[T]) Len() int
- func (s OrderedNumberArray[T]) Less(i, j int) bool
- func (f OrderedNumberArray[T]) Map(fn func(v T) (T, bool)) OrderedNumberArray[T]
- func (f OrderedNumberArray[T]) MarshalJSON() ([]byte, error)
- func (f OrderedNumberArray[T]) OneOf(vals []T) bool
- func (f *OrderedNumberArray[T]) Scan(value interface{}) error
- func (f OrderedNumberArray[T]) Sort() OrderedNumberArray[T]
- func (s OrderedNumberArray[T]) Swap(i, j int)
- func (f *OrderedNumberArray[T]) UnmarshalJSON(b []byte) error
- func (f OrderedNumberArray[T]) Value() (driver.Value, error)
- type StringArray
- func (f *StringArray) DecodeValue(v interface{}) error
- func (f StringArray) IndexOf(v string) int
- func (f StringArray) Join(sep string) string
- func (f StringArray) Len() int
- func (f StringArray) OneOf(vals []string) bool
- func (f *StringArray) Scan(value interface{}) error
- func (f *StringArray) SetArray(arr []string) *StringArray
- func (f *StringArray) UnmarshalJSON(b []byte) error
- func (f StringArray) Value() (driver.Value, error)
Constants ¶
const ( Nanosecond Duration = Duration(time.Nanosecond) Microsecond = Duration(time.Microsecond) Millisecond = Duration(time.Millisecond) Second = Duration(time.Second) Minute = Duration(time.Minute) Hour = Duration(time.Hour) )
Duration constants
Variables ¶
var ( ErrInvalidScan = errors.New("invalid field scan") ErrInvalidScanValue = errors.New("invalid field scan value") ErrNullValueNotAllowed = errors.New("nil value not allowed") ErrInvalidDecodeValue = errors.New("invalid decode value") )
Set of errors
Functions ¶
func ArrayNumberDecode ¶
ArrayNumberDecode decodes array of type int
Types ¶
type Char ¶
type Char rune
Char type of field
func (Char) MarshalJSON ¶
MarshalJSON implements the json.Marshaler
func (*Char) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller
type Duration ¶ added in v2.1.0
Duration is a wrapper around time.Duration that allows us to
func ParseDuration ¶ added in v2.1.0
ParseDuration parses a duration string.
func (Duration) Abs ¶ added in v2.1.0
Abs returns the absolute value of d. As a special case, math.MinInt64 is converted to math.MaxInt64.
func (Duration) Hours ¶ added in v2.1.0
Hours returns the duration as a floating point number of hours.
func (Duration) MarshalJSON ¶ added in v2.1.0
MarshalJSON implements the json.Marshaler interface.
func (Duration) Microseconds ¶ added in v2.1.0
Microseconds returns the duration as an integer microsecond count.
func (Duration) Milliseconds ¶ added in v2.1.0
Milliseconds returns the duration as an integer millisecond count.
func (Duration) Minutes ¶ added in v2.1.0
Minutes returns the duration as a floating point number of minutes.
func (Duration) Nanoseconds ¶ added in v2.1.0
Nanoseconds returns the duration as an integer nanosecond count.
func (Duration) Round ¶ added in v2.1.0
Round returns the result of rounding d to the nearest multiple of m. The rounding behavior for halfway values is to round away from zero. If the result exceeds the maximum (or minimum) value that can be stored in a Duration, Round returns the maximum (or minimum) duration. If m <= 0, Round returns d unchanged.
func (Duration) Seconds ¶ added in v2.1.0
Seconds returns the duration as a floating point number of seconds.
func (Duration) Truncate ¶ added in v2.1.0
Truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged.
func (*Duration) UnmarshalJSON ¶ added in v2.1.0
UnmarshalJSON implements the json.Unmarshaler interface.
type JSON ¶
type JSON[T any] struct { Data T }
JSON field
func (*JSON[T]) DecodeValue ¶
DecodeValue implements the gocast.Decoder
func (JSON[T]) MarshalJSON ¶
MarshalJSON implements the json.Marshaler
func (*JSON[T]) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller
type NullableJSON ¶
type NullableJSON[T any] struct { Data *T }
NullableJSON field
func MustNullableJSON ¶ added in v2.2.0
func MustNullableJSON[T any](val any) *NullableJSON[T]
MustNullableJSON creates new JSON object
func NewNullableJSON ¶
func NewNullableJSON[T any](val any) (*NullableJSON[T], error)
NewNullableJSON creates new JSON object
func (*NullableJSON[T]) DecodeValue ¶
func (f *NullableJSON[T]) DecodeValue(v any) error
DecodeValue implements the gocast.Decoder
func (NullableJSON[T]) MarshalJSON ¶
func (f NullableJSON[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (*NullableJSON[T]) Scan ¶
func (f *NullableJSON[T]) Scan(value any) error
Scan implements the driver.Valuer interface, json field interface
func (*NullableJSON[T]) SetValue ¶
func (f *NullableJSON[T]) SetValue(value any) error
SetValue of json
func (*NullableJSON[T]) UnmarshalJSON ¶
func (f *NullableJSON[T]) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller
type NullableNumberArray ¶
type NullableNumberArray[T Number] []T
NullableNumberArray type of field
func (*NullableNumberArray[T]) DecodeValue ¶
func (f *NullableNumberArray[T]) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (NullableNumberArray[T]) Filter ¶
func (f NullableNumberArray[T]) Filter(fn func(v T) bool) NullableNumberArray[T]
Filter current array and create filtered copy
func (NullableNumberArray[T]) IndexOf ¶
func (f NullableNumberArray[T]) IndexOf(v T) int
IndexOf array value
func (NullableNumberArray[T]) Less ¶
func (s NullableNumberArray[T]) Less(i, j int) bool
func (NullableNumberArray[T]) Map ¶
func (f NullableNumberArray[T]) Map(fn func(v T) (T, bool)) NullableNumberArray[T]
Map transforms every value into the target
func (NullableNumberArray[T]) MarshalJSON ¶
func (f NullableNumberArray[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (NullableNumberArray[T]) OneOf ¶
func (f NullableNumberArray[T]) OneOf(vals []T) bool
OneOf value in array
func (NullableNumberArray[T]) Ordered ¶
func (f NullableNumberArray[T]) Ordered() NullableOrderedNumberArray[T]
Ordered object
func (*NullableNumberArray[T]) Scan ¶
func (f *NullableNumberArray[T]) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []int field
func (NullableNumberArray[T]) Sort ¶
func (f NullableNumberArray[T]) Sort() NullableNumberArray[T]
Sort ints array
func (NullableNumberArray[T]) Swap ¶
func (s NullableNumberArray[T]) Swap(i, j int)
func (*NullableNumberArray[T]) UnmarshalJSON ¶
func (f *NullableNumberArray[T]) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller
type NullableOrderedNumberArray ¶
type NullableOrderedNumberArray[T Number] []T
NullableOrderedNumberArray[T Number] type of field
func (*NullableOrderedNumberArray[T]) DecodeValue ¶
func (f *NullableOrderedNumberArray[T]) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (NullableOrderedNumberArray[T]) Filter ¶
func (f NullableOrderedNumberArray[T]) Filter(fn func(v T) bool) NullableOrderedNumberArray[T]
Filter current array and create filtered copy
func (NullableOrderedNumberArray[T]) IndexOf ¶
func (f NullableOrderedNumberArray[T]) IndexOf(v T) int
IndexOf array value
func (NullableOrderedNumberArray[T]) Len ¶
func (s NullableOrderedNumberArray[T]) Len() int
Len of array
func (NullableOrderedNumberArray[T]) Less ¶
func (s NullableOrderedNumberArray[T]) Less(i, j int) bool
func (NullableOrderedNumberArray[T]) Map ¶
func (f NullableOrderedNumberArray[T]) Map(fn func(v T) (T, bool)) NullableOrderedNumberArray[T]
Map transforms every value into the target
func (NullableOrderedNumberArray[T]) MarshalJSON ¶
func (f NullableOrderedNumberArray[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (NullableOrderedNumberArray[T]) OneOf ¶
func (f NullableOrderedNumberArray[T]) OneOf(vals []T) bool
OneOf value in array
func (*NullableOrderedNumberArray[T]) Scan ¶
func (f *NullableOrderedNumberArray[T]) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []int field
func (NullableOrderedNumberArray[T]) Sort ¶
func (f NullableOrderedNumberArray[T]) Sort() NullableOrderedNumberArray[T]
Sort ints array
func (NullableOrderedNumberArray[T]) Swap ¶
func (s NullableOrderedNumberArray[T]) Swap(i, j int)
func (*NullableOrderedNumberArray[T]) UnmarshalJSON ¶
func (f *NullableOrderedNumberArray[T]) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller
type NullableStringArray ¶
type NullableStringArray []string
NullableStringArray implementation
func (*NullableStringArray) DecodeValue ¶
func (f *NullableStringArray) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (NullableStringArray) IndexOf ¶
func (f NullableStringArray) IndexOf(v string) int
IndexOf array value
func (NullableStringArray) Join ¶
func (f NullableStringArray) Join(sep string) string
Join array to string
func (NullableStringArray) MarshalJSON ¶
func (f NullableStringArray) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (NullableStringArray) OneOf ¶
func (f NullableStringArray) OneOf(vals []string) bool
OneOf value in array
func (*NullableStringArray) Scan ¶
func (f *NullableStringArray) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []string field
func (*NullableStringArray) SetArray ¶
func (f *NullableStringArray) SetArray(arr []string) *NullableStringArray
SetArray value
func (*NullableStringArray) UnmarshalJSON ¶
func (f *NullableStringArray) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller
type NumberArray ¶
type NumberArray[T Number] []T
NumberArray[T Number] type of field
func (*NumberArray[T]) DecodeValue ¶
func (f *NumberArray[T]) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (NumberArray[T]) Filter ¶
func (f NumberArray[T]) Filter(fn func(v T) bool) NumberArray[T]
Filter current NumberArray and create filtered copy
func (NumberArray[T]) Less ¶
func (s NumberArray[T]) Less(i, j int) bool
func (NumberArray[T]) Map ¶
func (f NumberArray[T]) Map(fn func(v T) (T, bool)) NumberArray[T]
Map transforms every value into the target
func (NumberArray[T]) MarshalJSON ¶
func (f NumberArray[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (NumberArray[T]) OneOf ¶
func (f NumberArray[T]) OneOf(vals []T) bool
OneOf value in NumberArray
func (NumberArray[T]) Ordered ¶
func (f NumberArray[T]) Ordered() OrderedNumberArray[T]
Ordered object
func (*NumberArray[T]) Scan ¶
func (f *NumberArray[T]) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []int field
func (NumberArray[T]) Swap ¶
func (s NumberArray[T]) Swap(i, j int)
func (*NumberArray[T]) UnmarshalJSON ¶
func (f *NumberArray[T]) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller
type OrderedNumberArray ¶
type OrderedNumberArray[T Number] []T
OrderedNumberArray type of field
func (*OrderedNumberArray[T]) DecodeValue ¶
func (f *OrderedNumberArray[T]) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (OrderedNumberArray[T]) Filter ¶
func (f OrderedNumberArray[T]) Filter(fn func(v T) bool) OrderedNumberArray[T]
Filter current array and create filtered copy
func (OrderedNumberArray[T]) IndexOf ¶
func (f OrderedNumberArray[T]) IndexOf(v T) int
IndexOf array value
func (OrderedNumberArray[T]) Less ¶
func (s OrderedNumberArray[T]) Less(i, j int) bool
func (OrderedNumberArray[T]) Map ¶
func (f OrderedNumberArray[T]) Map(fn func(v T) (T, bool)) OrderedNumberArray[T]
Map transforms every value into the target
func (OrderedNumberArray[T]) MarshalJSON ¶
func (f OrderedNumberArray[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler
func (OrderedNumberArray[T]) OneOf ¶
func (f OrderedNumberArray[T]) OneOf(vals []T) bool
OneOf value in array
func (*OrderedNumberArray[T]) Scan ¶
func (f *OrderedNumberArray[T]) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []int field
func (OrderedNumberArray[T]) Sort ¶
func (f OrderedNumberArray[T]) Sort() OrderedNumberArray[T]
Sort ints array
func (OrderedNumberArray[T]) Swap ¶
func (s OrderedNumberArray[T]) Swap(i, j int)
func (*OrderedNumberArray[T]) UnmarshalJSON ¶
func (f *OrderedNumberArray[T]) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller
type StringArray ¶
type StringArray NullableStringArray
StringArray implementation
func (*StringArray) DecodeValue ¶
func (f *StringArray) DecodeValue(v interface{}) error
DecodeValue implements the gocast.Decoder
func (*StringArray) Scan ¶
func (f *StringArray) Scan(value interface{}) error
Scan implements the driver.Valuer interface, []string field
func (*StringArray) SetArray ¶
func (f *StringArray) SetArray(arr []string) *StringArray
SetArray value
func (*StringArray) UnmarshalJSON ¶
func (f *StringArray) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaller