optional

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntoTime

func IntoTime(o Of[time.Time]) null.Time

Types

type Of

type Of[T any] struct {
	V     T
	Valid bool
}

func From

func From[T any](v T) Of[T]

func FromNonZero added in v0.4.8

func FromNonZero[T comparable](v T) Of[T]

func FromPtr added in v0.7.13

func FromPtr[T any](v *T) Of[T]

func FromTime

func FromTime(t null.Time) Of[time.Time]

func Map added in v0.4.8

func Map[T, U any](o Of[T], mapper func(T) U) Of[U]

func MapErr added in v0.7.0

func MapErr[T, U any](o Of[T], mapper func(T) (U, error)) (Of[U], error)

func None

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

func (Of[T]) ValueOrZero

func (o Of[T]) ValueOrZero() T

ValueOrZero 値が入っているときはその値を、そうでないときはゼロ値を返します。

Jump to

Keyboard shortcuts

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