Documentation ¶
Index ¶
- type Val
- func (v Val[T]) AsPointer() *T
- func (v Val[T]) Get() (T, bool)
- func (v Val[T]) HasVal() bool
- func (v Val[T]) MarshalJSON() ([]byte, error)
- func (v Val[T]) MarshalYAML() ([]byte, error)
- func (v *Val[T]) Reset()
- func (v *Val[T]) Scan(value any) error
- func (v *Val[T]) Set(val T)
- func (v *Val[T]) UnmarshalJSON(buf []byte) error
- func (v *Val[T]) UnmarshalYAML(bb []byte) error
- func (v Val[T]) Val() T
- func (v Val[T]) ValDefault(defaultVal T) T
- func (v Val[T]) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Val ¶
type Val[T any] struct { // contains filtered or unexported fields }
Val contains value and flag that mark this value as empty.
func NewFromPointer ¶
NewFromPointer create Val from pointer to some type. Nil pointer means that value not provided.
func (Val[T]) AsPointer ¶
func (v Val[T]) AsPointer() *T
AsPointer adapt value to pointer. It will return nil when value not provided.
func (Val[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Val[T]) MarshalYAML ¶
MarshalYAML implements the interface for marshaling yaml.
func (*Val[T]) Reset ¶ added in v0.2.0
func (v *Val[T]) Reset()
Reset will clear value and mark this as empty.
func (*Val[T]) Set ¶
func (v *Val[T]) Set(val T)
Set will set the value and mark that value is presented.
func (*Val[T]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Val[T]) UnmarshalYAML ¶
UnmarshalYAML implements the interface for unmarshalling yaml.
func (Val[T]) ValDefault ¶
func (v Val[T]) ValDefault(defaultVal T) T
ValDefault returns value, if presented or defaultVal in other case.
Click to show internal directories.
Click to hide internal directories.