package optional
import "cloud.google.com/go/internal/optional"
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(v Bool) bool
- func ToDuration(v Duration) time.Duration
- func ToFloat64(v Float64) float64
- func ToInt(v Int) int
- func ToString(v String) string
- func ToUint(v Uint) uint
- type Bool
- type Duration
- type Float64
- type Int
- type String
- type Uint
Functions ¶
func ToBool ¶
ToBool returns its argument as a bool. It panics if its argument is nil or not a bool.
func ToDuration ¶
ToDuration returns its argument as a time.Duration. It panics if its argument is nil or not a time.Duration.
func ToFloat64 ¶
ToFloat64 returns its argument as a float64. It panics if its argument is nil or not a float64.
func ToInt ¶
ToInt returns its argument as an int. It panics if its argument is nil or not an int.
func ToString ¶
ToString returns its argument as a string. It panics if its argument is nil or not a string.
func ToUint ¶
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 ¶
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.
Source Files ¶
optional.go
- Version
- v0.118.3 (latest)
- Published
- Feb 20, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 15 hours ago –
Tools for package owners.