CustomData

package
v0.2.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionalPair

type OptionalPair[A any, B any] struct {
	// contains filtered or unexported fields
}

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

type Pair

type Pair[A any, B any] struct {
	First  A
	Second B
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL