Documentation
¶
Index ¶
- Variables
- 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
- type Byte
- type Bytes
- type Float32
- type Float64
- type GenericNullable
- type Int
- type Int16
- type Int32
- type Int64
- type Int8
- type 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
- type MarshalError
- type Nullable
- type NullableImpl
- 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]) 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]) Value() (driver.Value, error)
- func (n NullableImpl[T]) ValueOrZero() T
- type ScannerError
- type String
- type Time
- type TimeFormatOption
- type TimeOptionFn
- type UUID
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint8
- type UnmarshalError
- type ValuerError
Constants ¶
This section is empty.
Variables ¶
var ( ErrCannotMarshal = errors.New("null: cannot marshal type") ErrCannotUnmarshal = errors.New("null: cannot unmarshal type") ErrCannotUnmarshalByte = errors.New( "null: cannot convert to byte, data length is greater than one", ) ErrCannotScan = errors.New("null: cannot scan type") ErrCannotValue = errors.New("null: cannot value type") ErrValuerCheckerAssertionFailed = errors.New("null: valuer checker assertion failed") ErrValuerCheckerTypeUnsupported = errors.New("null: valuer checker type unsupported") ErrValuerCheckerIntegerOverflow = errors.New("null: valuer checker integer overflow detected") ErrCannotMustValue = errors.New("null: cannot must value for type") ErrDestinationNil = errors.New("null: destination pointer is nil") ErrCannotNewUUID = errors.New("null: uuid value must be a string or implement fmt.Stringer") )
var ( // ZeroString is the zero value for the string type. ZeroString = "" // NullString is a string representation of null. NullString = "null" // ZeroIntegerString is a string representation of 0. ZeroIntegerString = "0" // TrueString is a string representation of true. TrueString = "true" // FalseString is a string representation of false. FalseString = "false" // ZeroUUIDString is a string representation of an empty uuid with all zeros. ZeroUUIDString = uuid.Nil.String() // ZeroInt is the zero value for the int type, which is at least 32 bits in size. ZeroInt int = 0 // ZeroInt8 is the zero value for the int8 type. ZeroInt8 int8 = 0 // ZeroInt16 is the zero value for the int16 type. ZeroInt16 int16 = 0 // ZeroInt32 is the zero value for the int32 type. ZeroInt32 int32 = 0 // ZeroInt64 is the zero value for the int64 type. ZeroInt64 int64 = 0 // ZeroUint is the zero value for the uint type, which is at least 32 bits in size. ZeroUint uint = 0 // ZeroUint8 is the zero value for the uint8 type. ZeroUint8 uint8 = 0 // ZeroUint16 is the zero value for the uint16 type. ZeroUint16 uint16 = 0 // ZeroUint32 is the zero value for the uint32 type ZeroUint32 uint32 = 0 // ZeroUint64 is the zero value for the uint64 type. ZeroUint64 uint64 = 0 // ZeroFloat32 is the zero value for the float32 type. ZeroFloat32 float32 = 0 // ZeroFloat64 is the zero value for the float64 type. ZeroFloat64 float64 = 0 // ZeroByte is the zero value for the byte type. ZeroByte byte = 0 // ZeroBytes is the zero value for the []byte type, which is a nil byte slice. ZeroBytes = []byte(nil) // ZeroBool is the zero value for the bool type. ZeroBool = false // ZeroTime is the zero value for the time.Time type. ZeroTime = time.Time{} // EmptyBytes is an empty byte slice. EmptyBytes = []byte{} // NullStringBytes is a byte slice of a "null" string value. NullStringBytes = []byte(NullString) // ZeroIntegerStringBytes is a byte slice of a "0" string value. ZeroIntegerStringBytes = []byte(ZeroIntegerString) // TrueStringBytes is a byte slice of a "true" string value. TrueStringBytes = []byte(TrueString) // FalseStringBytes is a byte slice of a "false" string value. FalseStringBytes = []byte(FalseString) // ZeroStringBytes is a byte slice of an empty string value. ZeroStringBytes = []byte(ZeroString) )
var DateParsePreferMonthFirst = true
DateParsePreferMonthFirst is an option that allows preferMonthFirst to be changed from its default
Functions ¶
func NewMarshalError ¶
NewMarshalError creates a new MarshalError. sourceType indicates the type of the value being marshaled. It accepts multiple errors and wraps them together.
func NewScannerError ¶
NewScannerError creates a new ScannerError. sourceType is the type being scanned from, and targetType is the type being scanned into. It accepts multiple errors and wraps them together.
func NewUnmarshalError ¶
NewUnmarshalError creates a new UnmarshalError. sourceType represents the type being unmarshaled from, and targetType is the type being unmarshaled into. It accepts multiple errors and wraps them together.
func NewValuerError ¶
NewValuerError creates a new ValuerError. sourceType represents the type that caused the error. It accepts multiple errors and wraps them together.
Types ¶
type Bool ¶
type Bool struct { NullableImpl[bool] }
Bool is a NullableImpl bool. It does not consider false values to be null. It will decode to null, not false, if null.
func BoolFromPtr ¶
BoolFromPtr creates a new Bool that will be null if the value is nil.
type Byte ¶
type Byte struct { NullableImpl[byte] }
Byte is an NullableImpl byte. It does not consider zero values to be null. It will decode to null, not zero, if null.
func ByteFromPtr ¶
ByteFromPtr creates a new Byte that will be null if the value is nil.
func (Byte) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Byte) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Byte) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Byte) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Bytes ¶
type Bytes struct { NullableImpl[[]byte] }
Bytes is a NullableImpl []byte.
func BytesFromPtr ¶
BytesFromPtr creates a new Bytes that will be null if the value is nil.
func (Bytes) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Float32 ¶
type Float32 struct { NullableImpl[float32] }
Float32 is a NullableImpl float32. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Float32From ¶
Float32From creates a new Float32 that will always be valid.
func Float32FromPtr ¶
Float32FromPtr creates a new Float32 that will be null if the value is nil.
func NewFloat32 ¶
NewFloat32 creates a new Float32
type Float64 ¶
type Float64 struct { NullableImpl[float64] }
Float64 is a NullableImpl float64. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Float64From ¶
Float64From creates a new Float64 that will always be valid.
func Float64FromPtr ¶
Float64FromPtr creates a new Float64 that will be null if the value is nil.
func NewFloat64 ¶
NewFloat64 creates a new Float64
type GenericNullable ¶
type GenericNullable[T any] interface { // Equal returns true if both values are equal and both are valid. Equal(other NullableImpl[T]) bool // IsValid returns true if the value is valid. IsValid() bool // IsZero returns true if the value is zero. IsZero() bool // MarshalJSON implements the json.Marshaler interface. MarshalJSON() ([]byte, error) // MarshalText implements the encoding.TextMarshaler interface. MarshalText() ([]byte, error) // MustValue returns the inner value if valid, otherwise panics if accessing an invalid value. MustValue() T // Ptr returns a pointer to the value, or nil if invalid. Ptr() *T // Scan implements the sql.Scanner interface. Scan(src any) (err error) // SetValue sets the value and marks it as valid. SetValue(value T) // UnmarshalJSON implements the json.Unmarshaler interface. UnmarshalJSON(data []byte) (err error) // UnmarshalText implements the encoding.TextUnmarshaler interface. UnmarshalText(data []byte) (err error) // Value implements the driver.Valuer interface. Value() (driver.Value, error) // ValueOrZero returns the inner value if valid, otherwise the zero value of T. ValueOrZero() T }
GenericNullable is an interface that provides methods for working with nullable values. A nullable value is a value that can be either valid or invalid (null), allowing for the representation of the absence of a value.
The interface defines methods for:
- Checking if a value is valid or invalid
- Comparing two nullable values
- Retrieving the inner value or its zero value
- Marshaling and unmarshaling to/from JSON and text formats
- Scanning from SQL values
- Setting and retrieving the value as a pointer or directly
- Converting to database driver valuer
Implementations of this interface should provide logic to handle the validity of the value, perform marshaling/unmarshaling, work with SQL data scanning, and support the driver.Valuer interface for database interactions.
type Int ¶
type Int struct { NullableImpl[int] // contains filtered or unexported fields }
Int is an NullableImpl int. It does not consider zero values to be null. It will decode to null, not zero, if null.
func IntFrom ¶
func IntFrom(value int, options ...IntegerOption) Int
IntFrom creates a new Int that will always be valid.
func IntFromPtr ¶
func IntFromPtr(value *int, options ...IntegerOption) Int
IntFromPtr creates a new Int that will be null if the value is nil.
type Int16 ¶
type Int16 struct { NullableImpl[int16] // contains filtered or unexported fields }
Int16 is an NullableImpl int16. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Int16From ¶
func Int16From(value int16, options ...IntegerOption) Int16
IntFrom creates a new Int that will always be valid.
func Int16FromPtr ¶
func Int16FromPtr(value *int16, options ...IntegerOption) Int16
Int16FromPtr creates a new Int16 that will be null if the value is nil.
type Int32 ¶
type Int32 struct { NullableImpl[int32] // contains filtered or unexported fields }
Int32 is an NullableImpl int32. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Int32From ¶
func Int32From(value int32, options ...IntegerOption) Int32
IntFrom creates a new Int that will always be valid.
func Int32FromPtr ¶
func Int32FromPtr(value *int32, options ...IntegerOption) Int32
Int32FromPtr creates a new Int32 that will be null if the value is nil.
type Int64 ¶
type Int64 struct { NullableImpl[int64] // contains filtered or unexported fields }
Int64 is an NullableImpl int64. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Int64From ¶
func Int64From(value int64, options ...IntegerOption) Int64
IntFrom creates a new Int that will always be valid.
func Int64FromPtr ¶
func Int64FromPtr(value *int64, options ...IntegerOption) Int64
Int64FromPtr creates a new Int64 that will be null if the value is nil.
type Int8 ¶
type Int8 struct { NullableImpl[int8] // contains filtered or unexported fields }
Int8 is an NullableImpl int8. It does not consider zero values to be null. It will decode to null, not zero, if null.
func Int8From ¶
func Int8From(value int8, options ...IntegerOption) Int8
IntFrom creates a new Int that will always be valid.
func Int8FromPtr ¶
func Int8FromPtr(value *int8, options ...IntegerOption) Int8
Int8FromPtr creates a new Int8 that will be null if the value is nil.
type IntegerOption ¶
type IntegerOption = func(*integerOption)
IntegerOption is a type alias for a function that modifies an IntegerOption.
func WithInt16Valuer ¶
func WithInt16Valuer() IntegerOption
WithInt16Valuer sets the valuerType to int16. This function is used when you want to handle integer values as type int16.
func WithInt32Valuer ¶
func WithInt32Valuer() IntegerOption
WithInt32Valuer sets the valuerType to int32. This function is used when you want to handle integer values as type int32.
func WithInt64Valuer ¶
func WithInt64Valuer() IntegerOption
WithInt64Valuer sets the valuerType to int64. This function is used when you want to handle integer values as type int64.
func WithInt8Valuer ¶
func WithInt8Valuer() IntegerOption
WithInt8Valuer sets the valuerType to int8. This function is used when you want to handle integer values as type int8.
func WithIntValuer ¶
func WithIntValuer() IntegerOption
WithIntValuer sets the valuerType to int. This function is used when you want to handle integer values as type int.
func WithIntegerValuer ¶
func WithIntegerValuer(value any) IntegerOption
WithIntegerValuer sets a custom integer type for value conversion. This function allows specifying any integer type as the valuerType.
func WithUint16Valuer ¶
func WithUint16Valuer() IntegerOption
WithUint16Valuer sets the valuerType to uint16. This function is used when you want to handle integer values as type uint16.
func WithUint32Valuer ¶
func WithUint32Valuer() IntegerOption
WithUint32Valuer sets the valuerType to uint32. This function is used when you want to handle integer values as type uint32.
func WithUint64Valuer ¶
func WithUint64Valuer() IntegerOption
WithUint64Valuer sets the valuerType to uint64. This function is used when you want to handle integer values as type uint64.
func WithUint8Valuer ¶
func WithUint8Valuer() IntegerOption
WithUint8Valuer sets the valuerType to uint8. This function is used when you want to handle integer values as type uint8.
func WithUintValuer ¶
func WithUintValuer() IntegerOption
WithUintValuer sets the valuerType to uint. This function is used when you want to handle integer values as type uint.
type JSON ¶
type JSON struct {
Bytes
}
JSON is a NullableImpl []byte that contains JSON.
You might want to use this in the case where you have lets say a NullableImpl JSON column in postgres for instance, where there is one layer of null for the postgres column, and then you also have the opportunity to have null as a value contained in the json. When unmarshalling json however you cannot set 'null' as a value.
func JSONFromPtr ¶
JSONFromPtr creates a new JSON that will be null if the value is nil.
func (*JSON) Marshal ¶
Marshal will marshal the passed in object, and store it in the JSON member on the JSON object.
func (JSON) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (JSON) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (JSON) Unmarshal ¶
Unmarshal will unmarshal your JSON stored in your JSON object and store the result in the value pointed to by dest.
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
Example if you have a struct with a nullify.JSON called v:
{"v": null} -> calls UnmarshalJSON: !valid {"v": {}} -> calls UnmarshalJSON: valid (json value is '{}')
If "null" is passed in as json, then the value will be set to nil. This way a sql.driver can convert nil to SQL NULL.
type MarshalError ¶
type MarshalError struct {
// contains filtered or unexported fields
}
MarshalError represents an error that occurs during marshaling. It contains the original error and the source type that caused the failure.
func (MarshalError) Error ¶
func (e MarshalError) Error() string
Error returns the string representation of the MarshalError.
func (MarshalError) Unwrap ¶
func (e MarshalError) Unwrap() error
Unwrap returns the underlying error for unwrapping.
type Nullable ¶
type Nullable interface { // IsValid returns true if the value is valid. IsValid() bool // IsZero returns true if the value is zero. IsZero() bool // MarshalJSON implements the json.Marshaler interface. MarshalJSON() ([]byte, error) // MarshalText implements the encoding.TextMarshaler interface. MarshalText() ([]byte, error) // Scan implements the sql.Scanner interface. Scan(src any) (err error) // UnmarshalJSON implements the json.Unmarshaler interface. UnmarshalJSON(data []byte) (err error) // UnmarshalText implements the encoding.TextUnmarshaler interface. UnmarshalText(data []byte) (err error) // Value implements the driver.Valuer interface. Value() (driver.Value, error) }
Nullable is an interface that provides methods for working with nullable values. A nullable value is a value that can be either valid or invalid (null), allowing for the representation of the absence of a value.
The interface defines methods for:
- Checking if a value is valid or invalid
- Marshaling and unmarshaling to/from JSON and text formats
- Scanning from SQL values
- Converting to database driver valuer
Implementations of this interface should provide logic to handle the validity of the value, perform marshaling/unmarshaling, work with SQL data scanning, and support the driver.Valuer interface for database interactions.
type NullableImpl ¶
type NullableImpl[T any] struct { // contains filtered or unexported fields }
NullableImpl represents a NullableImpl value of any type.
func From ¶
func From[T any](value T) NullableImpl[T]
From creates a new NullableImpl that is always valid.
func FromPtr ¶
func FromPtr[T any](ptr *T) NullableImpl[T]
FromPtr creates a new NullableImpl that is null if the pointer is nil.
func New ¶
func New[T any](value T, valid bool) NullableImpl[T]
New creates a new NullableImpl with a specified value and validity.
func (NullableImpl[T]) Equal ¶
func (n NullableImpl[T]) Equal(other NullableImpl[T]) bool
Equal returns true if both values are equal and both are valid.
func (NullableImpl[T]) IsValid ¶
func (n NullableImpl[T]) IsValid() bool
IsValid returns true if the value is valid.
func (NullableImpl[T]) IsZero ¶
func (n NullableImpl[T]) IsZero() bool
IsZero returns true if the value is zero.
func (NullableImpl[T]) MarshalJSON ¶
func (n NullableImpl[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (NullableImpl[T]) MarshalText ¶
func (n NullableImpl[T]) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (NullableImpl[T]) MustValue ¶
func (n NullableImpl[T]) MustValue() T
MustValue returns the inner value if valid, otherwise panics if accessing an invalid value.
func (NullableImpl[T]) Ptr ¶
func (n NullableImpl[T]) Ptr() *T
Ptr returns a pointer to the value, or nil if invalid.
func (*NullableImpl[T]) Scan ¶
func (n *NullableImpl[T]) Scan(src any) error
Scan implements the sql.Scanner interface.
func (*NullableImpl[T]) SetValue ¶
func (n *NullableImpl[T]) SetValue(value T)
SetValue sets the value and marks it as valid.
func (*NullableImpl[T]) UnmarshalJSON ¶
func (n *NullableImpl[T]) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*NullableImpl[T]) UnmarshalText ¶
func (n *NullableImpl[T]) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (NullableImpl[T]) Value ¶
func (n NullableImpl[T]) Value() (driver.Value, error)
Value implements the driver.Valuer interface.
func (NullableImpl[T]) ValueOrZero ¶
func (n NullableImpl[T]) ValueOrZero() T
ValueOrZero returns the inner value if valid, otherwise the zero value of T.
type ScannerError ¶
type ScannerError struct {
// contains filtered or unexported fields
}
ScannerError represents an error that occurs during scanning. It contains the original error, source type, and target type.
func (ScannerError) Error ¶
func (e ScannerError) Error() string
Error returns the string representation of the ScannerError.
func (ScannerError) Unwrap ¶
func (e ScannerError) Unwrap() error
Unwrap returns the underlying error for unwrapping.
type String ¶
type String struct { NullableImpl[string] }
String is a NullableImpl string. It supports SQL and JSON serialization. It will marshal to null if null. Blank string input will be considered null.
func StringFrom ¶
StringFrom creates a new String that will always be valid.
func StringFromPtr ¶
StringFromPtr creates a new String that will be null if the value is nil.
type Time ¶
type Time struct { NullableImpl[time.Time] // contains filtered or unexported fields }
Time is a NullableImpl time.Time. It supports SQL and JSON serialization.
func NewTime ¶
func NewTime(value time.Time, valid bool, options ...TimeOptionFn) Time
NewTime creates a new Time with RFC3339 layout.
func TimeFrom ¶
func TimeFrom(value time.Time, options ...TimeOptionFn) Time
TimeFrom creates a new Time with RFC3339 layout that will always be valid.
func TimeFromPtr ¶
func TimeFromPtr(value *time.Time, options ...TimeOptionFn) Time
TimeFromPtr creates a new Time with RFC3339 layout that will be null if the value is nil.
func (Time) Format ¶
func (n Time) Format(options ...TimeFormatOption) string
Format returns a textual representation of the time value formatted according to the layout defined by the argument. If none option argument is specified then it defaults to RFC3339.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Time) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Time) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type TimeFormatOption ¶
type TimeFormatOption = func(*timeFormatOption)
TimeFormatOptionFn is a function type that modifies a formatOption instance. It is used to apply different formatting options when formatting a Time value.
func WithTimeDefaultLayoutFormat ¶
func WithTimeDefaultLayoutFormat() TimeFormatOption
WithDefaultLayout returns a FormatOptionFn that sets the layout to the RFC3339 format.
func WithTimeLayoutFormat ¶
func WithTimeLayoutFormat() TimeFormatOption
WithTimeLayout returns a FormatOptionFn that sets the useTimeLayout flag to true. When this option is used, the formatter will use the layout associated with the Time instance.
func WithTimeLayoutValue ¶
func WithTimeLayoutValue(layout string) TimeFormatOption
WithLayoutValue returns a FormatOptionFn that sets a custom layout for formatting the time value. This is useful when you want to specify a particular format.
type TimeOptionFn ¶
type TimeOptionFn = func(*Time)
TimeOptionFn is a type alias for a function that modifies an TimeOption.
func WithTimeDefaultLayout ¶
func WithTimeDefaultLayout() TimeOptionFn
WithTimeDefaultLayout sets the time layout to the RFC3339 format.
func WithTimeLayout ¶
func WithTimeLayout(layout string) TimeOptionFn
WithTimeLayout sets a time layout.
func WithTimeLenientParsing ¶
func WithTimeLenientParsing() TimeOptionFn
WithTimeLenientParsing enables lenient time paring when json.Unmarshaler and encoding.TextUnmarshaler are called.
func WithTimeParseOptions ¶
func WithTimeParseOptions(options ...dateparse.ParserOption) TimeOptionFn
WithTimeLayout sets a time layout.
func WithTimeStrictParsing ¶
func WithTimeStrictParsing() TimeOptionFn
WithTimeStrictParsing enables strict time paring when json.Unmarshaler and encoding.TextUnmarshaler are called.
type UUID ¶
type UUID struct { NullableImpl[uuid.UUID] }
UUID is a NullableImpl uuid.UUID. It supports SQL and JSON serialization. It will marshal to null if null.
func NewUUID ¶
NewUUID creates a new UUID. value can be any uuid type with a String method or a string value. Will panic if given value cannot be parsed as an uuid.
func UUIDFrom ¶
UUIDFrom creates a new UUID that will always be valid. value can be any uuid type with a String method. Will panic if given value cannot be parsed as an uuid.
func UUIDFromPtr ¶
UUIDFromPtr creates a new UUID that will be null if the value is nil. value can be any uuid type with a String method. Will panic if the given value cannot be parsed as an uuid, unless the value is nil.
func (UUID) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (UUID) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*UUID) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Uint ¶
type Uint struct { NullableImpl[uint] // contains filtered or unexported fields }
Uint is an NullableImpl uint. It does not consider zero values to be null. It will decode to null, not zero, if null.
func NewUint ¶
func NewUint(value uint, valid bool, options ...IntegerOption) Uint
NewInt creates a new Int
func UintFrom ¶
func UintFrom(value uint, options ...IntegerOption) Uint
IntFrom creates a new Int that will always be valid.
func UintFromPtr ¶
func UintFromPtr(value *uint, options ...IntegerOption) Uint
UintFromPtr creates a new Uint that will be null if the value is nil.
type Uint16 ¶
type Uint16 struct { NullableImpl[uint16] // contains filtered or unexported fields }
Uint16 is an NullableImpl uint16. It does not consider zero values to be null. It will decode to null, not zero, if null.
func NewUint16 ¶
func NewUint16(value uint16, valid bool, options ...IntegerOption) Uint16
NewInt creates a new Int
func Uint16From ¶
func Uint16From(value uint16, options ...IntegerOption) Uint16
IntFrom creates a new Int that will always be valid.
func Uint16FromPtr ¶
func Uint16FromPtr(value *uint16, options ...IntegerOption) Uint16
Uint16FromPtr creates a new Uint16 that will be null if the value is nil.
type Uint32 ¶
type Uint32 struct { NullableImpl[uint32] // contains filtered or unexported fields }
Uint32 is an NullableImpl uint32. It does not consider zero values to be null. It will decode to null, not zero, if null.
func NewUint32 ¶
func NewUint32(value uint32, valid bool, options ...IntegerOption) Uint32
NewInt creates a new Int
func Uint32From ¶
func Uint32From(value uint32, options ...IntegerOption) Uint32
IntFrom creates a new Int that will always be valid.
func Uint32FromPtr ¶
func Uint32FromPtr(value *uint32, options ...IntegerOption) Uint32
Uint32FromPtr creates a new Uint32 that will be null if the value is nil.
type Uint64 ¶
type Uint64 struct { NullableImpl[uint64] // contains filtered or unexported fields }
Uint64 is an NullableImpl uint64. It does not consider zero values to be null. It will decode to null, not zero, if null.
func NewUint64 ¶
func NewUint64(value uint64, valid bool, options ...IntegerOption) Uint64
NewInt creates a new Int
func Uint64From ¶
func Uint64From(value uint64, options ...IntegerOption) Uint64
IntFrom creates a new Int that will always be valid.
func Uint64FromPtr ¶
func Uint64FromPtr(value *uint64, options ...IntegerOption) Uint64
Uint64FromPtr creates a new Uint64 that will be null if the value is nil.
type Uint8 ¶
type Uint8 struct { NullableImpl[uint8] // contains filtered or unexported fields }
Uint8 is an NullableImpl uint8. It does not consider zero values to be null. It will decode to null, not zero, if null.
func NewUint8 ¶
func NewUint8(value uint8, valid bool, options ...IntegerOption) Uint8
NewInt creates a new Int
func Uint8From ¶
func Uint8From(value uint8, options ...IntegerOption) Uint8
IntFrom creates a new Int that will always be valid.
func Uint8FromPtr ¶
func Uint8FromPtr(value *uint8, options ...IntegerOption) Uint8
Uint8FromPtr creates a new Uint8 that will be null if the value is nil.
type UnmarshalError ¶
type UnmarshalError struct {
// contains filtered or unexported fields
}
UnmarshalError represents an error that occurs during unmarshaling. It contains the original error, source type, and target type.
func (UnmarshalError) Error ¶
func (e UnmarshalError) Error() string
Error returns the string representation of the UnmarshalError.
func (UnmarshalError) Unwrap ¶
func (e UnmarshalError) Unwrap() error
Unwrap returns the underlying error for unwrapping.
type ValuerError ¶
type ValuerError struct {
// contains filtered or unexported fields
}
ValuerError represents an error that occurs when attempting to retrieve a value. It contains the original error and the source type.
func (ValuerError) Error ¶
func (e ValuerError) Error() string
Error returns the string representation of the ValuerError.
func (ValuerError) Unwrap ¶
func (e ValuerError) Unwrap() error
Unwrap returns the underlying error for unwrapping.