Documentation
¶
Index ¶
- type Void
- func (v Void[V]) Equal(other Void[V]) bool
- func (v Void[V]) Get() V
- func (v Void[V]) IsVoid() bool
- func (v Void[V]) MarshalJSON() ([]byte, error)
- func (v Void[V]) Ptr() *V
- func (v *Void[V]) Scan(src any) error
- func (v *Void[V]) Set(value V)
- func (v *Void[V]) UnmarshalJSON(data []byte) error
- func (v *Void[V]) UnmarshalText(text []byte) error
- func (v *Void[V]) Unset()
- func (v Void[V]) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Void ¶
type Void[V any] struct { // contains filtered or unexported fields }
Void is a generic wrapper type that can represent a value that may be explicitly undefined or unset, which is particularly useful for:
- JSON marshaling/unmarshaling where fields can be omitted
- Database operations where NULL values need to be distinguished from zero values
Supported types for V include:
- Basic types
- time.Time for timestamp handling
- []byte for binary data
- nil for explicit NULL values in databases
The zero value of Void[V] is considered undefined (valid = false).
func (Void[V]) MarshalJSON ¶
Implement json.Marshaler
func (*Void[V]) UnmarshalJSON ¶
Implement json.Unmarshaler
func (*Void[V]) UnmarshalText ¶
Implement encoding.TextUnmarshaler
Click to show internal directories.
Click to hide internal directories.