Documentation ¶
Index ¶
- type OptionalPair
- func (b OptionalPair[A, B]) Get() (Pair[A, B], error)
- func (b OptionalPair[A, B]) If(fn func(Pair[A, B]))
- func (b OptionalPair[A, B]) MarshalJSON() ([]byte, error)
- func (b OptionalPair[A, B]) MustGet() Pair[A, B]
- func (b OptionalPair[A, B]) OrElse(v Pair[A, B]) Pair[A, B]
- func (b OptionalPair[A, B]) Present() bool
- func (b *OptionalPair[A, B]) Set(v Pair[A, B])
- func (b OptionalPair[A, B]) ToPtr() *Pair[A, B]
- func (b *OptionalPair[A, B]) UnmarshalJSON(data []byte) error
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionalPair ¶
OptionalPair is an optional pair.
func NewOptionalPair ¶
func NewOptionalPair[A any, B any](v Pair[A, B]) OptionalPair[A, B]
NewOptionalPair creates an optional.OptionalPair from a pair.
func NewOptionalPairFromPtr ¶
func NewOptionalPairFromPtr[A any, B any](v *Pair[A, B]) OptionalPair[A, B]
NewOptionalPairFromPtr creates an optional.OptionalPair from a pair pointer.
func (OptionalPair[A, B]) Get ¶
func (b OptionalPair[A, B]) Get() (Pair[A, B], error)
Get returns the pair value or an error if not present.
func (OptionalPair[A, B]) If ¶
func (b OptionalPair[A, B]) If(fn func(Pair[A, B]))
If calls the function f with the value if the value is present.
func (OptionalPair[A, B]) MarshalJSON ¶
func (b OptionalPair[A, B]) MarshalJSON() ([]byte, error)
func (OptionalPair[A, B]) MustGet ¶
func (b OptionalPair[A, B]) MustGet() Pair[A, B]
MustGet returns the pair value or panics if not present.
func (OptionalPair[A, B]) OrElse ¶
func (b OptionalPair[A, B]) OrElse(v Pair[A, B]) Pair[A, B]
OrElse returns the pair value or a default value if the value is not present.
func (OptionalPair[A, B]) Present ¶
func (b OptionalPair[A, B]) Present() bool
Present returns whether or not the value is present.
func (*OptionalPair[A, B]) Set ¶
func (b *OptionalPair[A, B]) Set(v Pair[A, B])
Set sets the pair value.
func (OptionalPair[A, B]) ToPtr ¶
func (b OptionalPair[A, B]) ToPtr() *Pair[A, B]
ToPtr returns a *pair of the value or nil if not present.
func (*OptionalPair[A, B]) UnmarshalJSON ¶
func (b *OptionalPair[A, B]) UnmarshalJSON(data []byte) error
Directories ¶
Path | Synopsis |
---|---|
Package counter provides a set of interfaces and methods for managing counters.
|
Package counter provides a set of interfaces and methods for managing counters. |
List
Package ListLike provides a Lister interface that defines methods for a list data structure.
|
Package ListLike provides a Lister interface that defines methods for a list data structure. |
Queue
Package ListLike provides a Queuer interface that defines methods for a queue data structure.
|
Package ListLike provides a Queuer interface that defines methods for a queue data structure. |
Stack
Package ListLike provides a Stacker interface that defines methods for a stack data structure.
|
Package ListLike provides a Stacker interface that defines methods for a stack data structure. |
Click to show internal directories.
Click to hide internal directories.