Documentation
¶
Index ¶
- func ConvertOpt[T any, O Opt[T], U any](opt O, f func(T) U) U
- func ConvertPtr[T, U any](ptr *T, fn func(T) U) *U
- func Deref[T any](ptr *T, def T) T
- func Ptr[T any](value T) *T
- func ZeroPtr[T comparable](value T) *T
- type ComparableText
- type Null
- type NullBool
- func NewBoolFromFuncPtr[T ~bool, U any](value *U, f func(*U) T) NullBool[T]
- func NewNullBool[T ~bool](value T, valid bool) NullBool[T]
- func NullBoolFrom[T ~bool](value T) NullBool[T]
- func NullBoolFromFunc[T ~bool, U any](value *U, f func(U) T) NullBool[T]
- func NullBoolFromPtr[T ~bool](value *T) NullBool[T]
- func (v NullBool[T]) Get() (value T, ok bool)
- func (v NullBool[T]) IsZero() bool
- func (v NullBool[T]) MarshalJSON() ([]byte, error)
- func (v NullBool[T]) MarshalText() ([]byte, error)
- func (v NullBool[T]) Or(value T) T
- func (v *NullBool[T]) Ptr() *T
- func (v *NullBool[T]) Set(value T)
- func (v NullBool[T]) Std() sql.NullBool
- func (v *NullBool[T]) UnmarshalJSON(data []byte) error
- func (v *NullBool[T]) UnmarshalText(data []byte) error
- type NullFloat
- func NewNullFloat[T constraints.Float](value T, valid bool) NullFloat[T]
- func NullFloatFrom[T constraints.Float](value T) NullFloat[T]
- func NullFloatFromFunc[T constraints.Float, U any](value *U, f func(U) T) NullFloat[T]
- func NullFloatFromFuncPtr[T constraints.Float, U any](value *U, f func(*U) T) NullFloat[T]
- func NullFloatFromPtr[T constraints.Float](value *T) NullFloat[T]
- func (v NullFloat[T]) Get() (value T, ok bool)
- func (v NullFloat[T]) IsZero() bool
- func (v NullFloat[T]) MarshalJSON() ([]byte, error)
- func (v NullFloat[T]) MarshalText() ([]byte, error)
- func (v NullFloat[T]) Or(value T) T
- func (v *NullFloat[T]) Ptr() *T
- func (v *NullFloat[T]) Set(value T)
- func (v NullFloat[T]) Std() sql.NullFloat64
- func (v *NullFloat[T]) UnmarshalJSON(data []byte) error
- func (v *NullFloat[T]) UnmarshalText(data []byte) error
- type NullInt
- func NewNullInt[T constraints.Int](value T, valid bool) NullInt[T]
- func NullIntFrom[T constraints.Int](value T) NullInt[T]
- func NullIntFromFunc[T constraints.Int, U any](value *U, f func(U) T) NullInt[T]
- func NullIntFromFuncPtr[T constraints.Int, U any](value *U, f func(*U) T) NullInt[T]
- func NullIntFromPtr[T constraints.Int](value *T) NullInt[T]
- func (v NullInt[T]) Get() (value T, ok bool)
- func (v NullInt[T]) IsZero() bool
- func (v NullInt[T]) MarshalJSON() ([]byte, error)
- func (v NullInt[T]) MarshalText() ([]byte, error)
- func (v NullInt[T]) Or(value T) T
- func (v *NullInt[T]) Ptr() *T
- func (v *NullInt[T]) Set(value T)
- func (v NullInt[T]) Std() sql.NullInt64
- func (v NullInt[T]) Std16() sql.NullInt16
- func (v NullInt[T]) Std32() sql.NullInt32
- func (v NullInt[T]) Std64() sql.NullInt64
- func (v *NullInt[T]) UnmarshalJSON(data []byte) error
- func (v *NullInt[T]) UnmarshalText(data []byte) error
- type NullString
- func NewNullString[T ~string](value T, valid bool) NullString[T]
- func NullStringFrom[T ~string](value T) NullString[T]
- func NullStringFromFunc[T ~string, U any](value *U, f func(U) T) NullString[T]
- func NullStringFromFuncPtr[T ~string, U any](value *U, f func(*U) T) NullString[T]
- func NullStringFromPtr[T ~string](value *T) NullString[T]
- func (v NullString[T]) Get() (value T, ok bool)
- func (v NullString[T]) IsZero() bool
- func (v NullString[T]) MarshalJSON() ([]byte, error)
- func (v NullString[T]) MarshalText() ([]byte, error)
- func (v NullString[T]) Or(value T) T
- func (v *NullString[T]) Ptr() *T
- func (v *NullString[T]) Set(value T)
- func (v NullString[T]) Std() sql.NullString
- func (v *NullString[T]) UnmarshalJSON(data []byte) error
- func (v *NullString[T]) UnmarshalText(data []byte) error
- type NullText
- func NewNullText[T Text](value T, valid bool) NullText[T]
- func NullTextFrom[T Text](value T) NullText[T]
- func NullTextFromFunc[T Text, U any](value *U, f func(U) T) NullText[T]
- func NullTextFromFuncPtr[T Text, U any](value *U, f func(*U) T) NullText[T]
- func NullTextFromPtr[T Text](value *T) NullText[T]
- type NullTime
- func (v NullTime) Get() (value time.Time, ok bool)
- func (v NullTime) IsZero() bool
- func (v NullTime) MarshalJSON() ([]byte, error)
- func (v NullTime) MarshalText() ([]byte, error)
- func (v NullTime) Or(value time.Time) time.Time
- func (v *NullTime) Ptr() *time.Time
- func (v *NullTime) Set(value time.Time)
- func (v NullTime) Std() sql.NullTime
- func (v *NullTime) UnmarshalJSON(data []byte) error
- func (v *NullTime) UnmarshalText(data []byte) error
- type Opt
- type Text
- type Zero
- type ZeroBool
- func NewZeroBool[T ~bool](value T, valid bool) ZeroBool[T]
- func ZeroBoolFrom[T ~bool](value T) ZeroBool[T]
- func ZeroBoolFromFunc[T ~bool, U any](value *U, f func(U) T) ZeroBool[T]
- func ZeroBoolFromFuncPtr[T ~bool, U any](value *U, f func(*U) T) ZeroBool[T]
- func ZeroBoolFromPtr[T ~bool](value *T) ZeroBool[T]
- func (v ZeroBool[T]) Get() (value T, ok bool)
- func (v ZeroBool[T]) IsZero() bool
- func (v ZeroBool[T]) MarshalJSON() ([]byte, error)
- func (v ZeroBool[T]) MarshalText() ([]byte, error)
- func (v ZeroBool[T]) Or(value T) T
- func (v *ZeroBool[T]) Ptr() *T
- func (v *ZeroBool[T]) Set(value T)
- func (v ZeroBool[T]) Std() sql.NullBool
- func (v *ZeroBool[T]) UnmarshalJSON(data []byte) error
- func (v *ZeroBool[T]) UnmarshalText(data []byte) error
- type ZeroFloat
- func NewZeroFloat[T constraints.Float](value T, valid bool) ZeroFloat[T]
- func ZeroFloatFrom[T constraints.Float](value T) ZeroFloat[T]
- func ZeroFloatFromFunc[T constraints.Float, U any](value *U, f func(U) T) ZeroFloat[T]
- func ZeroFloatFromFuncPtr[T constraints.Float, U any](value *U, f func(*U) T) ZeroFloat[T]
- func ZeroFloatFromPtr[T constraints.Float](value *T) ZeroFloat[T]
- func (v ZeroFloat[T]) Get() (value T, ok bool)
- func (v ZeroFloat[T]) IsZero() bool
- func (v ZeroFloat[T]) MarshalJSON() ([]byte, error)
- func (v ZeroFloat[T]) MarshalText() ([]byte, error)
- func (v ZeroFloat[T]) Or(value T) T
- func (v *ZeroFloat[T]) Ptr() *T
- func (v *ZeroFloat[T]) Set(value T)
- func (v ZeroFloat[T]) Std() sql.NullFloat64
- func (v *ZeroFloat[T]) UnmarshalJSON(data []byte) error
- func (v *ZeroFloat[T]) UnmarshalText(data []byte) error
- type ZeroInt
- func NewZeroInt[T constraints.Int](value T, valid bool) ZeroInt[T]
- func ZeroIntFrom[T constraints.Int](value T) ZeroInt[T]
- func ZeroIntFromFunc[T constraints.Int, U any](value *U, f func(U) T) ZeroInt[T]
- func ZeroIntFromFuncPtr[T constraints.Int, U any](value *U, f func(*U) T) ZeroInt[T]
- func ZeroIntFromPtr[T constraints.Int](value *T) ZeroInt[T]
- func (v ZeroInt[T]) Get() (value T, ok bool)
- func (v ZeroInt[T]) IsZero() bool
- func (v ZeroInt[T]) MarshalJSON() ([]byte, error)
- func (v ZeroInt[T]) MarshalText() ([]byte, error)
- func (v ZeroInt[T]) Or(value T) T
- func (v *ZeroInt[T]) Ptr() *T
- func (v *ZeroInt[T]) Set(value T)
- func (v ZeroInt[T]) Std() sql.NullInt64
- func (v ZeroInt[T]) Std16() sql.NullInt16
- func (v ZeroInt[T]) Std32() sql.NullInt32
- func (v ZeroInt[T]) Std64() sql.NullInt64
- func (v *ZeroInt[T]) UnmarshalJSON(data []byte) error
- func (v *ZeroInt[T]) UnmarshalText(data []byte) error
- type ZeroString
- func NewZeroString[T ~string](value T, valid bool) ZeroString[T]
- func ZeroStringFrom[T ~string](value T) ZeroString[T]
- func ZeroStringFromFunc[T ~string, U any](value *U, f func(U) T) ZeroString[T]
- func ZeroStringFromFuncPtr[T ~string, U any](value *U, f func(*U) T) ZeroString[T]
- func ZeroStringFromPtr[T ~string](value *T) ZeroString[T]
- func (v ZeroString[T]) Get() (value T, ok bool)
- func (v ZeroString[T]) IsZero() bool
- func (v ZeroString[T]) MarshalJSON() ([]byte, error)
- func (v ZeroString[T]) MarshalText() ([]byte, error)
- func (v ZeroString[T]) Or(value T) T
- func (v *ZeroString[T]) Ptr() *T
- func (v *ZeroString[T]) Set(value T)
- func (v ZeroString[T]) Std() sql.NullString
- func (v *ZeroString[T]) UnmarshalJSON(data []byte) error
- func (v *ZeroString[T]) UnmarshalText(data []byte) error
- type ZeroText
- func NewZeroText[T ComparableText](value T, valid bool) ZeroText[T]
- func ZeroTextFrom[T ComparableText](value T) ZeroText[T]
- func ZeroTextFromFunc[T ComparableText, U any](value *U, f func(U) T) ZeroText[T]
- func ZeroTextFromFuncPtr[T ComparableText, U any](value *U, f func(*U) T) ZeroText[T]
- func ZeroTextFromPtr[T ComparableText](value *T) ZeroText[T]
- type ZeroTime
- func (v ZeroTime) Get() (value time.Time, ok bool)
- func (v ZeroTime) IsZero() bool
- func (v ZeroTime) MarshalJSON() ([]byte, error)
- func (v ZeroTime) MarshalText() ([]byte, error)
- func (v ZeroTime) Or(value time.Time) time.Time
- func (v *ZeroTime) Ptr() *time.Time
- func (v *ZeroTime) Set(value time.Time)
- func (v ZeroTime) Std() sql.NullTime
- func (v *ZeroTime) UnmarshalJSON(data []byte) error
- func (v *ZeroTime) UnmarshalText(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertOpt ¶ added in v1.3.0
func ConvertPtr ¶ added in v1.1.0
func ConvertPtr[T, U any](ptr *T, fn func(T) U) *U
func ZeroPtr ¶
func ZeroPtr[T comparable](value T) *T
Types ¶
type ComparableText ¶
type ComparableText interface {
comparable
Text
}
type Null ¶
func NullFromFunc ¶ added in v1.4.0
func NullFromFuncPtr ¶ added in v1.4.1
func NullFromPtr ¶
func (Null[T]) MarshalJSON ¶
func (*Null[T]) UnmarshalJSON ¶
type NullBool ¶
func NewBoolFromFuncPtr ¶ added in v1.4.1
func NewNullBool ¶
func NullBoolFrom ¶
func NullBoolFromFunc ¶ added in v1.4.0
func NullBoolFromPtr ¶
func (NullBool[T]) MarshalJSON ¶
func (NullBool[T]) MarshalText ¶
func (*NullBool[T]) UnmarshalJSON ¶
func (*NullBool[T]) UnmarshalText ¶
type NullFloat ¶
type NullFloat[T constraints.Float] struct { Value T Valid bool }
func NewNullFloat ¶
func NewNullFloat[T constraints.Float](value T, valid bool) NullFloat[T]
func NullFloatFrom ¶
func NullFloatFrom[T constraints.Float](value T) NullFloat[T]
func NullFloatFromFunc ¶ added in v1.4.0
func NullFloatFromFunc[T constraints.Float, U any](value *U, f func(U) T) NullFloat[T]
func NullFloatFromFuncPtr ¶ added in v1.4.1
func NullFloatFromFuncPtr[T constraints.Float, U any](value *U, f func(*U) T) NullFloat[T]
func NullFloatFromPtr ¶
func NullFloatFromPtr[T constraints.Float](value *T) NullFloat[T]
func (NullFloat[T]) MarshalJSON ¶
func (NullFloat[T]) MarshalText ¶
func (NullFloat[T]) Std ¶
func (v NullFloat[T]) Std() sql.NullFloat64
func (*NullFloat[T]) UnmarshalJSON ¶
func (*NullFloat[T]) UnmarshalText ¶
type NullInt ¶
type NullInt[T constraints.Int] struct { Value T Valid bool }
func NewNullInt ¶
func NewNullInt[T constraints.Int](value T, valid bool) NullInt[T]
func NullIntFrom ¶
func NullIntFrom[T constraints.Int](value T) NullInt[T]
func NullIntFromFunc ¶ added in v1.4.0
func NullIntFromFunc[T constraints.Int, U any](value *U, f func(U) T) NullInt[T]
func NullIntFromFuncPtr ¶ added in v1.4.1
func NullIntFromFuncPtr[T constraints.Int, U any](value *U, f func(*U) T) NullInt[T]
func NullIntFromPtr ¶
func NullIntFromPtr[T constraints.Int](value *T) NullInt[T]
func (NullInt[T]) MarshalJSON ¶
func (NullInt[T]) MarshalText ¶
func (*NullInt[T]) UnmarshalJSON ¶
func (*NullInt[T]) UnmarshalText ¶
type NullString ¶
func NewNullString ¶
func NewNullString[T ~string](value T, valid bool) NullString[T]
func NullStringFrom ¶
func NullStringFrom[T ~string](value T) NullString[T]
func NullStringFromFunc ¶ added in v1.4.0
func NullStringFromFunc[T ~string, U any](value *U, f func(U) T) NullString[T]
func NullStringFromFuncPtr ¶ added in v1.4.1
func NullStringFromFuncPtr[T ~string, U any](value *U, f func(*U) T) NullString[T]
func NullStringFromPtr ¶
func NullStringFromPtr[T ~string](value *T) NullString[T]
func (NullString[T]) Get ¶
func (v NullString[T]) Get() (value T, ok bool)
func (NullString[T]) IsZero ¶
func (v NullString[T]) IsZero() bool
func (NullString[T]) MarshalJSON ¶
func (v NullString[T]) MarshalJSON() ([]byte, error)
func (NullString[T]) MarshalText ¶
func (v NullString[T]) MarshalText() ([]byte, error)
func (NullString[T]) Or ¶
func (v NullString[T]) Or(value T) T
func (*NullString[T]) Ptr ¶
func (v *NullString[T]) Ptr() *T
func (*NullString[T]) Set ¶
func (v *NullString[T]) Set(value T)
func (NullString[T]) Std ¶
func (v NullString[T]) Std() sql.NullString
func (*NullString[T]) UnmarshalJSON ¶
func (v *NullString[T]) UnmarshalJSON(data []byte) error
func (*NullString[T]) UnmarshalText ¶
func (v *NullString[T]) UnmarshalText(data []byte) error
type NullText ¶
func NewNullText ¶
func NullTextFrom ¶
func NullTextFromFunc ¶ added in v1.4.0
func NullTextFromFuncPtr ¶ added in v1.4.1
func NullTextFromPtr ¶
func (NullText[T]) MarshalText ¶
func (*NullText[T]) UnmarshalText ¶
type NullTime ¶
func NullTimeFrom ¶
func NullTimeFromFunc ¶ added in v1.4.0
func NullTimeFromFuncPtr ¶ added in v1.4.1
func NullTimeFromPtr ¶
func (NullTime) MarshalJSON ¶
func (NullTime) MarshalText ¶
func (*NullTime) UnmarshalJSON ¶
func (*NullTime) UnmarshalText ¶
type Text ¶
type Text interface {
encoding.TextMarshaler
encoding.TextUnmarshaler
}
type Zero ¶
type Zero[T comparable] struct { Value T Valid bool }
func NewZero ¶
func NewZero[T comparable](value T, valid bool) Zero[T]
func ZeroFrom ¶
func ZeroFrom[T comparable](value T) Zero[T]
func ZeroFromFunc ¶ added in v1.4.0
func ZeroFromFunc[T comparable, U any](value *U, f func(U) T) Zero[T]
func ZeroFromFuncPtr ¶ added in v1.4.1
func ZeroFromFuncPtr[T comparable, U any](value *U, f func(*U) T) Zero[T]
func ZeroFromPtr ¶
func ZeroFromPtr[T comparable](value *T) Zero[T]
func (Zero[T]) MarshalJSON ¶
func (*Zero[T]) UnmarshalJSON ¶
type ZeroBool ¶
func NewZeroBool ¶
func ZeroBoolFrom ¶
func ZeroBoolFromFunc ¶ added in v1.4.0
func ZeroBoolFromFuncPtr ¶ added in v1.4.1
func ZeroBoolFromPtr ¶
func (ZeroBool[T]) MarshalJSON ¶
func (ZeroBool[T]) MarshalText ¶
func (*ZeroBool[T]) UnmarshalJSON ¶
func (*ZeroBool[T]) UnmarshalText ¶
type ZeroFloat ¶
type ZeroFloat[T constraints.Float] struct { Value T Valid bool }
func NewZeroFloat ¶
func NewZeroFloat[T constraints.Float](value T, valid bool) ZeroFloat[T]
func ZeroFloatFrom ¶
func ZeroFloatFrom[T constraints.Float](value T) ZeroFloat[T]
func ZeroFloatFromFunc ¶ added in v1.4.0
func ZeroFloatFromFunc[T constraints.Float, U any](value *U, f func(U) T) ZeroFloat[T]
func ZeroFloatFromFuncPtr ¶ added in v1.4.1
func ZeroFloatFromFuncPtr[T constraints.Float, U any](value *U, f func(*U) T) ZeroFloat[T]
func ZeroFloatFromPtr ¶
func ZeroFloatFromPtr[T constraints.Float](value *T) ZeroFloat[T]
func (ZeroFloat[T]) MarshalJSON ¶
func (ZeroFloat[T]) MarshalText ¶
func (ZeroFloat[T]) Std ¶
func (v ZeroFloat[T]) Std() sql.NullFloat64
func (*ZeroFloat[T]) UnmarshalJSON ¶
func (*ZeroFloat[T]) UnmarshalText ¶
type ZeroInt ¶
type ZeroInt[T constraints.Int] struct { Value T Valid bool }
func NewZeroInt ¶
func NewZeroInt[T constraints.Int](value T, valid bool) ZeroInt[T]
func ZeroIntFrom ¶
func ZeroIntFrom[T constraints.Int](value T) ZeroInt[T]
func ZeroIntFromFunc ¶ added in v1.4.0
func ZeroIntFromFunc[T constraints.Int, U any](value *U, f func(U) T) ZeroInt[T]
func ZeroIntFromFuncPtr ¶ added in v1.4.1
func ZeroIntFromFuncPtr[T constraints.Int, U any](value *U, f func(*U) T) ZeroInt[T]
func ZeroIntFromPtr ¶
func ZeroIntFromPtr[T constraints.Int](value *T) ZeroInt[T]
func (ZeroInt[T]) MarshalJSON ¶
func (ZeroInt[T]) MarshalText ¶
func (*ZeroInt[T]) UnmarshalJSON ¶
func (*ZeroInt[T]) UnmarshalText ¶
type ZeroString ¶
func NewZeroString ¶
func NewZeroString[T ~string](value T, valid bool) ZeroString[T]
func ZeroStringFrom ¶
func ZeroStringFrom[T ~string](value T) ZeroString[T]
func ZeroStringFromFunc ¶ added in v1.4.0
func ZeroStringFromFunc[T ~string, U any](value *U, f func(U) T) ZeroString[T]
func ZeroStringFromFuncPtr ¶ added in v1.4.1
func ZeroStringFromFuncPtr[T ~string, U any](value *U, f func(*U) T) ZeroString[T]
func ZeroStringFromPtr ¶
func ZeroStringFromPtr[T ~string](value *T) ZeroString[T]
func (ZeroString[T]) Get ¶
func (v ZeroString[T]) Get() (value T, ok bool)
func (ZeroString[T]) IsZero ¶ added in v1.3.1
func (v ZeroString[T]) IsZero() bool
func (ZeroString[T]) MarshalJSON ¶
func (v ZeroString[T]) MarshalJSON() ([]byte, error)
func (ZeroString[T]) MarshalText ¶
func (v ZeroString[T]) MarshalText() ([]byte, error)
func (ZeroString[T]) Or ¶
func (v ZeroString[T]) Or(value T) T
func (*ZeroString[T]) Ptr ¶
func (v *ZeroString[T]) Ptr() *T
func (*ZeroString[T]) Set ¶
func (v *ZeroString[T]) Set(value T)
func (ZeroString[T]) Std ¶
func (v ZeroString[T]) Std() sql.NullString
func (*ZeroString[T]) UnmarshalJSON ¶
func (v *ZeroString[T]) UnmarshalJSON(data []byte) error
func (*ZeroString[T]) UnmarshalText ¶
func (v *ZeroString[T]) UnmarshalText(data []byte) error
type ZeroText ¶
type ZeroText[T ComparableText] struct { Zero[T] }
func NewZeroText ¶
func NewZeroText[T ComparableText](value T, valid bool) ZeroText[T]
func ZeroTextFrom ¶
func ZeroTextFrom[T ComparableText](value T) ZeroText[T]
func ZeroTextFromFunc ¶ added in v1.4.0
func ZeroTextFromFunc[T ComparableText, U any](value *U, f func(U) T) ZeroText[T]
func ZeroTextFromFuncPtr ¶ added in v1.4.1
func ZeroTextFromFuncPtr[T ComparableText, U any](value *U, f func(*U) T) ZeroText[T]
func ZeroTextFromPtr ¶
func ZeroTextFromPtr[T ComparableText](value *T) ZeroText[T]
func (ZeroText[T]) MarshalText ¶
func (*ZeroText[T]) UnmarshalText ¶
type ZeroTime ¶
func ZeroTimeFrom ¶
func ZeroTimeFromFunc ¶ added in v1.4.0
func ZeroTimeFromFuncPtr ¶ added in v1.4.1
func ZeroTimeFromPtr ¶
func (ZeroTime) MarshalJSON ¶
func (ZeroTime) MarshalText ¶
func (*ZeroTime) UnmarshalJSON ¶
func (*ZeroTime) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.