types

package
v0.5.502 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNoneOption

func NewNoneOption[T NonNilT]() *option[T]

func NewOption

func NewOption[T NonNilT](value T) *option[T]

Types

type Durations

type Durations []time.Duration

func (Durations) Avg

func (d Durations) Avg() time.Duration

func (Durations) First

func (d Durations) First() *time.Duration

func (Durations) Last

func (d Durations) Last() *time.Duration

func (Durations) Sort

func (d Durations) Sort(ascending ...bool)

func (Durations) Sum

func (d Durations) Sum() time.Duration

type NonNilT

type NonNilT interface {
	~int | ~float64 | ~string | ~bool
}

type Option

type Option[T NonNilT] interface {
	IsNone() bool
	ValueOrErr() (T, error)
	ValueOr(def T) T
	ValueOrPanic() T
	SetValue(value T)
	SetNone()
	UnmarshalJSON(data []byte) error
}

Jump to

Keyboard shortcuts

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