Documentation
¶
Index ¶
- func Ptr[T any](v T) *T
- type Omit
- func (o Omit[T]) IsZero() bool
- func (o Omit[T]) MarshalBinary() ([]byte, error)
- func (o Omit[T]) MarshalJSON() ([]byte, error)
- func (o Omit[T]) MarshalText() ([]byte, error)
- func (o Omit[T]) Or(def T) T
- func (o Omit[T]) String() string
- func (o *Omit[T]) UnmarshalBinary(data []byte) error
- func (o *Omit[T]) UnmarshalJSON(data []byte) error
- func (o *Omit[T]) UnmarshalText(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Omit ¶
Omit is a type that can be used to represent a value which may or may not be set. This is useful for omitting the value in JSON. The zero value of Omit is not set.
func (Omit[T]) IsZero ¶
IsZero returns true if the value is not set. This is useful for omitting the value in JSON.
func (Omit[T]) MarshalBinary ¶
MarshalBinary marshals the value if it is set, otherwise it returns nil.
func (Omit[T]) MarshalJSON ¶
MarshalJSON marshals the value if it is set, otherwise it returns nil.
func (Omit[T]) MarshalText ¶
MarshalText marshals the value if it is set, otherwise it returns nil.
func (Omit[T]) Or ¶
func (o Omit[T]) Or(def T) T
Or returns the value if it is set, otherwise it returns the default value.
func (Omit[T]) String ¶
String returns the string representation of the value if it is set, otherwise it returns "<omitted>".
func (*Omit[T]) UnmarshalBinary ¶
UnmarshalBinary unmarshals the value if it is set, otherwise it returns nil.
func (*Omit[T]) UnmarshalJSON ¶
UnmarshalJSON unmarshals the value if it is set, otherwise it returns nil.
func (*Omit[T]) UnmarshalText ¶
UnmarshalText unmarshals the value if it is set, otherwise it returns nil.
