Documentation
¶
Index ¶
- type Option
- func (o Option[T]) Has() bool
- func (o Option[T]) MarshalJSON() ([]byte, error)
- func (o Option[T]) MarshalYAML() (any, error)
- func (o *Option[T]) UnmarshalJSON(data []byte) error
- func (o *Option[T]) UnmarshalYAML(value *yaml.Node) error
- func (o Option[T]) Value() T
- func (o Option[T]) ValueOrDefault(v T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option[T any] []T
Option is a generic type that can hold a value of type T or be empty (None).
It must use the slice type to work with "chi" form values binding: * non-existing value are represented as an empty slice (None) * existing value is represented as a slice with one element (Some) * multiple values are represented as a slice with multiple elements (Some), the Value is the first element (not well-defined in this case)
func FromMapLookup ¶ added in v1.24.3
func FromMapLookup[K comparable, V any](m map[K]V, k K) Option[V]
func FromNonDefault ¶
func FromNonDefault[T comparable](v T) Option[T]
func ParseBool ¶ added in v1.24.0
ParseBool get the corresponding optional.Option[bool] of a string using strconv.ParseBool
func (Option[T]) MarshalJSON ¶
func (Option[T]) MarshalYAML ¶
func (*Option[T]) UnmarshalJSON ¶
func (*Option[T]) UnmarshalYAML ¶
func (Option[T]) ValueOrDefault ¶
func (o Option[T]) ValueOrDefault(v T) T
Click to show internal directories.
Click to hide internal directories.