Documentation ¶
Index ¶
- type Value
- func (o Value[T]) Get() (T, bool)
- func (o Value[T]) IsSet() bool
- func (o Value[T]) IsZero() bool
- func (o Value[T]) MarshalJSON() ([]byte, error)
- func (o Value[T]) MarshalYAML() (T, error)
- func (o *Value[T]) Reset()
- func (o *Value[T]) Set(value T)
- func (o *Value[T]) UnmarshalJSON(data []byte) error
- func (o *Value[T]) UnmarshalYAML(unmarshal func(any) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value is an optional value
func Coalesce ¶
Coalesce will return the first optional value that is set (or returns an unset optional value if none is found).
func CoalesceZero ¶
Coalesce will return the first optional value that is set and not "zero" (or returns an unset optional value if none is found).
func (Value[T]) IsZero ¶
IsZero is used by the yaml marshaller to determine "zero"-ness for omitempty we're using it for the `set` bool
func (Value[T]) MarshalJSON ¶
MarshalJSON outputs the value of the Value, if `set` is set. otherwise, it returns nil
func (Value[T]) MarshalYAML ¶
MarshalYAML outputs the value of the Value, if `set` is set. otherwise, it returns nil
func (*Value[T]) UnmarshalJSON ¶
UnmarshalJSON unmarshals a value out of json and safely into our struct
Click to show internal directories.
Click to hide internal directories.