Back to godoc.org

Package optional

v0.70.0
Latest Go to latest

The latest major version is .

Published: Oct 19, 2020 | License: Apache-2.0 | Module: cloud.google.com/go

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

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

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.

type Bool

type Bool interface{}

Bool is either a bool or nil.

type Duration

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier