Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type None ¶
type None[T any] struct{}
None represents an Optional instance that does not contain any value.
func (*None[T]) Get ¶
func (n *None[T]) Get() T
Get always returns the zero value of type T since None contains no value.
type Optional ¶
type Optional[T any] interface { // IsPresent returns true if there is a value present, otherwise false. IsPresent() bool // IsEmpty returns true if there is no value present, otherwise false. IsEmpty() bool // Get returns the value if present. If no value is present, it returns the zero value of type T. Get() T }
Optional represents a container object which may or may not contain a non-nil value. It provides a type-safe alternative to using nil pointers.
type Some ¶
type Some[T any] struct { // contains filtered or unexported fields }
Some represents an Optional instance that contains a value.
func (*Some[T]) Get ¶
func (s *Some[T]) Get() T
Get returns the underlying value. If the receiver is nil, it returns the zero value of type T.
Click to show internal directories.
Click to hide internal directories.