Documentation
¶
Index ¶
- type T
- func (o T[U]) GoString() string
- func (o T[U]) MarshalJSON() ([]byte, error)
- func (o *T[U]) Or(def U) U
- func (o *T[U]) Pointer() *U
- func (o *T[U]) Reset()
- func (o *T[U]) Scan(src any) error
- func (o *T[U]) Set(v U)
- func (o T[U]) String() string
- func (o *T[U]) UnmarshalJSON(b []byte) error
- func (o *T[U]) Unwrap() (U, bool)
- func (o T[U]) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T[U any] struct { // contains filtered or unexported fields }
T is an optional type.
func FromPointer ¶ added in v1.0.3
FromPointer returns an optional that is only valid if v is not nil. v will be dereferenced and stored as a value.
func TryMap ¶ added in v1.0.4
TryMap applies mapFn to value, returning Some if successful, otherwise None.
func (T[U]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*T[U]) Or ¶ added in v1.1.0
func (o *T[U]) Or(def U) U
Or returns the value in the container if valid, or else a default value.
func (*T[U]) Pointer ¶
func (o *T[U]) Pointer() *U
Pointer returns a pointer to the inner value, if valid.
func (*T[U]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
Click to show internal directories.
Click to hide internal directories.