optional

package
v0.121.6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation ΒΆ

Overview ΒΆ

Package optional provides versions of primitive types that can be nil. These are useful in methods that update some of an API object's fields.

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func ToBool ΒΆ

func ToBool(v Bool) bool

ToBool returns its argument as a bool. It panics if its argument is nil or not a bool.

func ToDuration ΒΆ added in v0.12.0

func ToDuration(v Duration) time.Duration

ToDuration returns its argument as a time.Duration. It panics if its argument is nil or not a time.Duration.

func ToFloat64 ΒΆ

func ToFloat64(v Float64) float64

ToFloat64 returns its argument as a float64. It panics if its argument is nil or not a float64.

func ToInt ΒΆ

func ToInt(v Int) int

ToInt returns its argument as an int. It panics if its argument is nil or not an int.

func ToString ΒΆ

func ToString(v String) string

ToString returns its argument as a string. It panics if its argument is nil or not a string.

func ToUint ΒΆ

func ToUint(v Uint) uint

ToUint returns its argument as a uint. It panics if its argument is nil or not a uint.

Types ΒΆ

type Bool ΒΆ

type Bool interface{}

Bool is either a bool or nil.

type Duration ΒΆ added in v0.12.0

type Duration interface{}

Duration is either a time.Duration or nil.

type Float64 ΒΆ

type Float64 interface{}

Float64 is either a float64 or nil.

type Int ΒΆ

type Int interface{}

Int is either an int or nil.

type String ΒΆ

type String interface{}

String is either a string or nil.

type Uint ΒΆ

type Uint interface{}

Uint is either a uint or nil.

Jump to

Keyboard shortcuts

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