optional

package
v0.0.0-...-41af0e9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Optional

type Optional[T any] struct {
	// contains filtered or unexported fields
}

func None

func None[T any]() Optional[T]

func Some

func Some[T any](v T) Optional[T]

func (Optional[T]) Get

func (o Optional[T]) Get() T

func (Optional[T]) GetDefault

func (o Optional[T]) GetDefault(x T) T

func (Optional[T]) GetOr

func (o Optional[T]) GetOr(f func() T) T

func (Optional[T]) IsNone

func (o Optional[T]) IsNone() bool

func (Optional[T]) IsSome

func (o Optional[T]) IsSome() bool

func (Optional[T]) MarshalJSON

func (o Optional[T]) MarshalJSON() ([]byte, error)

func (*Optional[T]) Scan

func (o *Optional[T]) Scan(value any) error

func (*Optional[T]) UnmarshalJSON

func (o *Optional[T]) UnmarshalJSON(b []byte) error

func (Optional[T]) Value

func (o Optional[T]) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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