optional

package
v1.10.41 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 None

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

func (Of[T]) Map added in v1.10.28

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

func (Of[T]) MapErr added in v1.10.28

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

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