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 ¶
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
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.
Types ¶
type Duration ¶ added in v0.12.0
type Duration interface{}
Duration is either a time.Duration or nil.
Source Files
¶
- optional.go