maybe

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolDecoder

func BoolDecoder() func(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error)

BoolDecoder implements config parsing for maybe.Bool

func DurationDecoder added in v0.27.0

func DurationDecoder() func(from, to reflect.Type, data any) (any, error)

DurationDecoder implements config parsing for maybe.Duration

Types

type Bool

type Bool struct {
	Optional[bool]
}

func BoolFromNilable added in v0.27.0

func BoolFromNilable(value *bool) Bool

func False

func False() Bool

func SetBool added in v0.27.0

func SetBool(value bool) Bool

func True

func True() Bool

func UnsetBool added in v0.27.0

func UnsetBool() Bool

func (Bool) IsFalseOrUndefined

func (value Bool) IsFalseOrUndefined() bool

func (Bool) IsStrictlyFalse

func (value Bool) IsStrictlyFalse() bool

func (Bool) IsTrue

func (value Bool) IsTrue() bool

func (Bool) IsTrueOrUndefined

func (value Bool) IsTrueOrUndefined() bool

func (Bool) IsUndefined

func (value Bool) IsUndefined() bool

type Duration added in v0.27.0

type Duration struct {
	Optional[time.Duration]
}

Duration implements Optional[time.Duration]

func SetDuration added in v0.27.0

func SetDuration(value time.Duration) Duration

SetDuration returns a maybe.Duration with value

type Optional

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

func Set

func Set[T any](value T) Optional[T]

func (Optional[T]) HasValue

func (m Optional[T]) HasValue() bool

func (Optional[T]) MarshalJSON

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

func (Optional[T]) Nilable added in v0.27.0

func (m Optional[T]) Nilable() *T

func (Optional[T]) String added in v0.27.0

func (m Optional[T]) String() string

func (*Optional[T]) UnmarshalJSON

func (m *Optional[T]) UnmarshalJSON(data []byte) error

func (Optional[T]) Value

func (m Optional[T]) Value() T

Jump to

Keyboard shortcuts

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