Versions in this module Expand all Collapse all v1 v1.0.0 Sep 8, 2024 Changes in this version + var DateParsePreferMonthFirst = true + var EmptyBytes = []byte + var ErrCannotMarshal = errors.New("null: cannot marshal type") + var ErrCannotMustValue = errors.New("null: cannot must value for type") + var ErrCannotNewUUID = errors.New("null: uuid value must be a string or implement fmt.Stringer") + var ErrCannotScan = errors.New("null: cannot scan type") + var ErrCannotUnmarshal = errors.New("null: cannot unmarshal type") + var ErrCannotUnmarshalByte = errors.New("null: cannot convert to byte, data length is greater than one") + var ErrCannotValue = errors.New("null: cannot value type") + var ErrDestinationNil = errors.New("null: destination pointer is nil") + var ErrValuerCheckerAssertionFailed = errors.New("null: valuer checker assertion failed") + var ErrValuerCheckerIntegerOverflow = errors.New("null: valuer checker integer overflow detected") + var ErrValuerCheckerTypeUnsupported = errors.New("null: valuer checker type unsupported") + var FalseString = "false" + var FalseStringBytes = []byte(FalseString) + var NullString = "null" + var NullStringBytes = []byte(NullString) + var TrueString = "true" + var TrueStringBytes = []byte(TrueString) + var ZeroBool = false + var ZeroByte byte = 0 + var ZeroBytes = []byte(nil) + var ZeroFloat32 float32 = 0 + var ZeroFloat64 float64 = 0 + var ZeroInt int = 0 + var ZeroInt16 int16 = 0 + var ZeroInt32 int32 = 0 + var ZeroInt64 int64 = 0 + var ZeroInt8 int8 = 0 + var ZeroIntegerString = "0" + var ZeroIntegerStringBytes = []byte(ZeroIntegerString) + var ZeroString = "" + var ZeroStringBytes = []byte(ZeroString) + var ZeroTime = time.Time + var ZeroUUIDString = uuid.Nil.String() + var ZeroUint uint = 0 + var ZeroUint16 uint16 = 0 + var ZeroUint32 uint32 = 0 + var ZeroUint64 uint64 = 0 + var ZeroUint8 uint8 = 0 + func NewMarshalError(sourceType any, errors ...error) error + func NewScannerError(sourceType any, targetType any, errors ...error) error + func NewUnmarshalError(sourceType any, targetType any, errors ...error) error + func NewValuerError(sourceType any, errors ...error) error + type Bool struct + func BoolFrom(value bool) Bool + func BoolFromPtr(value *bool) Bool + func NewBool(value bool, valid bool) Bool + type Byte struct + func ByteFrom(value byte) Byte + func ByteFromPtr(value *byte) Byte + func NewByte(value byte, valid bool) Byte + func (n *Byte) Scan(src any) error + func (n *Byte) UnmarshalJSON(data []byte) error + func (n *Byte) UnmarshalText(text []byte) error + func (n Byte) MarshalJSON() ([]byte, error) + func (n Byte) MarshalText() ([]byte, error) + type Bytes struct + func BytesFrom(value []byte) Bytes + func BytesFromPtr(value *[]byte) Bytes + func NewBytes(value []byte, valid bool) Bytes + func (n *Bytes) UnmarshalJSON(data []byte) error + func (n *Bytes) UnmarshalText(text []byte) error + func (n Bytes) MarshalJSON() ([]byte, error) + func (n Bytes) MarshalText() ([]byte, error) + type Float32 struct + func Float32From(value float32) Float32 + func Float32FromPtr(value *float32) Float32 + func NewFloat32(value float32, valid bool) Float32 + type Float64 struct + func Float64From(value float64) Float64 + func Float64FromPtr(value *float64) Float64 + func NewFloat64(value float64, valid bool) Float64 + type GenericNullable interface + Equal func(other NullableImpl[T]) bool + IsValid func() bool + IsZero func() bool + MarshalJSON func() ([]byte, error) + MarshalText func() ([]byte, error) + MustValue func() T + Ptr func() *T + Scan func(src any) (err error) + SetValue func(value T) + UnmarshalJSON func(data []byte) (err error) + UnmarshalText func(data []byte) (err error) + Value func() (driver.Value, error) + ValueOrZero func() T + type Int struct + func IntFrom(value int, options ...IntegerOption) Int + func IntFromPtr(value *int, options ...IntegerOption) Int + func NewInt(value int, valid bool, options ...IntegerOption) Int + func (n Int) Value() (driver.Value, error) + type Int16 struct + func Int16From(value int16, options ...IntegerOption) Int16 + func Int16FromPtr(value *int16, options ...IntegerOption) Int16 + func NewInt16(value int16, valid bool, options ...IntegerOption) Int16 + func (n Int16) Value() (driver.Value, error) + type Int32 struct + func Int32From(value int32, options ...IntegerOption) Int32 + func Int32FromPtr(value *int32, options ...IntegerOption) Int32 + func NewInt32(value int32, valid bool, options ...IntegerOption) Int32 + func (n Int32) Value() (driver.Value, error) + type Int64 struct + func Int64From(value int64, options ...IntegerOption) Int64 + func Int64FromPtr(value *int64, options ...IntegerOption) Int64 + func NewInt64(value int64, valid bool, options ...IntegerOption) Int64 + func (n Int64) Value() (driver.Value, error) + type Int8 struct + func Int8From(value int8, options ...IntegerOption) Int8 + func Int8FromPtr(value *int8, options ...IntegerOption) Int8 + func NewInt8(value int8, valid bool, options ...IntegerOption) Int8 + func (n Int8) Value() (driver.Value, error) + type IntegerOption = func(*integerOption) + func WithInt16Valuer() IntegerOption + func WithInt32Valuer() IntegerOption + func WithInt64Valuer() IntegerOption + func WithInt8Valuer() IntegerOption + func WithIntValuer() IntegerOption + func WithIntegerValuer(value any) IntegerOption + func WithUint16Valuer() IntegerOption + func WithUint32Valuer() IntegerOption + func WithUint64Valuer() IntegerOption + func WithUint8Valuer() IntegerOption + func WithUintValuer() IntegerOption + type JSON struct + func JSONFrom(value []byte) JSON + func JSONFromPtr(value *[]byte) JSON + func NewJSON(value []byte, valid bool) JSON + func (n *JSON) Marshal(data any) error + func (n *JSON) UnmarshalJSON(data []byte) error + func (n JSON) MarshalJSON() ([]byte, error) + func (n JSON) MarshalText() ([]byte, error) + func (n JSON) Unmarshal(dest any) error + type MarshalError struct + func (e MarshalError) Error() string + func (e MarshalError) Unwrap() error + type Nullable interface + IsValid func() bool + IsZero func() bool + MarshalJSON func() ([]byte, error) + MarshalText func() ([]byte, error) + Scan func(src any) (err error) + UnmarshalJSON func(data []byte) (err error) + UnmarshalText func(data []byte) (err error) + Value func() (driver.Value, error) + type NullableImpl struct + func FromPtr[T any](ptr *T) NullableImpl[T] + func From[T any](value T) NullableImpl[T] + func New[T any](value T, valid bool) NullableImpl[T] + func (n *NullableImpl[T]) Scan(src any) error + func (n *NullableImpl[T]) SetValue(value T) + func (n *NullableImpl[T]) UnmarshalJSON(data []byte) error + func (n *NullableImpl[T]) UnmarshalText(text []byte) error + func (n NullableImpl[T]) Equal(other NullableImpl[T]) bool + func (n NullableImpl[T]) IsValid() bool + func (n NullableImpl[T]) IsZero() bool + func (n NullableImpl[T]) MarshalJSON() ([]byte, error) + func (n NullableImpl[T]) MarshalText() ([]byte, error) + func (n NullableImpl[T]) MustValue() T + func (n NullableImpl[T]) Ptr() *T + func (n NullableImpl[T]) Value() (driver.Value, error) + func (n NullableImpl[T]) ValueOrZero() T + type ScannerError struct + func (e ScannerError) Error() string + func (e ScannerError) Unwrap() error + type String struct + func NewString(value string, valid bool) String + func StringFrom(value string) String + func StringFromPtr(value *string) String + type Time struct + func NewTime(value time.Time, valid bool, options ...TimeOptionFn) Time + func TimeFrom(value time.Time, options ...TimeOptionFn) Time + func TimeFromPtr(value *time.Time, options ...TimeOptionFn) Time + func (n *Time) Scan(src any) (err error) + func (n *Time) UnmarshalJSON(data []byte) error + func (n *Time) UnmarshalText(text []byte) (err error) + func (n Time) Format(options ...TimeFormatOption) string + func (n Time) MarshalJSON() ([]byte, error) + func (n Time) MarshalText() ([]byte, error) + type TimeFormatOption = func(*timeFormatOption) + func WithTimeDefaultLayoutFormat() TimeFormatOption + func WithTimeLayoutFormat() TimeFormatOption + func WithTimeLayoutValue(layout string) TimeFormatOption + type TimeOptionFn = func(*Time) + func WithTimeDefaultLayout() TimeOptionFn + func WithTimeLayout(layout string) TimeOptionFn + func WithTimeLenientParsing() TimeOptionFn + func WithTimeParseOptions(options ...dateparse.ParserOption) TimeOptionFn + func WithTimeStrictParsing() TimeOptionFn + type UUID struct + func NewRandomUUID() UUID + func NewUUID(value any, valid bool) UUID + func UUIDFrom(value any) UUID + func UUIDFromPtr(value any) UUID + func (n *UUID) Scan(src any) error + func (n *UUID) UnmarshalJSON(data []byte) error + func (n *UUID) UnmarshalText(text []byte) (err error) + func (n UUID) MarshalJSON() (data []byte, err error) + func (n UUID) MarshalText() ([]byte, error) + func (n UUID) Value() (driver.Value, error) + type Uint struct + func NewUint(value uint, valid bool, options ...IntegerOption) Uint + func UintFrom(value uint, options ...IntegerOption) Uint + func UintFromPtr(value *uint, options ...IntegerOption) Uint + func (n Uint) Value() (driver.Value, error) + type Uint16 struct + func NewUint16(value uint16, valid bool, options ...IntegerOption) Uint16 + func Uint16From(value uint16, options ...IntegerOption) Uint16 + func Uint16FromPtr(value *uint16, options ...IntegerOption) Uint16 + func (n Uint16) Value() (driver.Value, error) + type Uint32 struct + func NewUint32(value uint32, valid bool, options ...IntegerOption) Uint32 + func Uint32From(value uint32, options ...IntegerOption) Uint32 + func Uint32FromPtr(value *uint32, options ...IntegerOption) Uint32 + func (n Uint32) Value() (driver.Value, error) + type Uint64 struct + func NewUint64(value uint64, valid bool, options ...IntegerOption) Uint64 + func Uint64From(value uint64, options ...IntegerOption) Uint64 + func Uint64FromPtr(value *uint64, options ...IntegerOption) Uint64 + func (n Uint64) Value() (driver.Value, error) + type Uint8 struct + func NewUint8(value uint8, valid bool, options ...IntegerOption) Uint8 + func Uint8From(value uint8, options ...IntegerOption) Uint8 + func Uint8FromPtr(value *uint8, options ...IntegerOption) Uint8 + func (n Uint8) Value() (driver.Value, error) + type UnmarshalError struct + func (e UnmarshalError) Error() string + func (e UnmarshalError) Unwrap() error + type ValuerError struct + func (e ValuerError) Error() string + func (e ValuerError) Unwrap() error