Documentation ¶
Index ¶
- func AllPtrFieldsNil(obj interface{}) bool
- func BoolPtr(b bool) *bool
- func BoolPtrDerefOr(ptr *bool, def bool) bool
- func Float32Ptr(i float32) *float32
- func Float32PtrDerefOr(ptr *float32, def float32) float32
- func Float64Ptr(i float64) *float64
- func Float64PtrDerefOr(ptr *float64, def float64) float64
- func Int32Ptr(i int32) *int32
- func Int32PtrDerefOr(ptr *int32, def int32) int32
- func Int64Ptr(i int64) *int64
- func Int64PtrDerefOr(ptr *int64, def int64) int64
- func StringPtr(s string) *string
- func StringPtrDerefOr(ptr *string, def string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllPtrFieldsNil ¶
func AllPtrFieldsNil(obj interface{}) bool
AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when, for example, an API struct is handled by plugins which need to distinguish "no plugin accepted this spec" from "this spec is empty".
This function is only valid for structs and pointers to structs. Any other type will cause a panic. Passing a typed nil pointer will return true.
func BoolPtrDerefOr ¶
BoolPtrDerefOr dereference the bool ptr and returns it if not nil, else returns def.
func Float32Ptr ¶
Float32Ptr returns a pointer to the passed float32.
func Float32PtrDerefOr ¶
Float32PtrDerefOr dereference the float32 ptr and returns it if not nil, else returns def.
func Float64Ptr ¶
Float64Ptr returns a pointer to the passed float64.
func Float64PtrDerefOr ¶
Float64PtrDerefOr dereference the float64 ptr and returns it if not nil, else returns def.
func Int32PtrDerefOr ¶
Int32PtrDerefOr dereference the int32 ptr and returns it if not nil, else returns def.
func Int64PtrDerefOr ¶
Int64PtrDerefOr dereference the int64 ptr and returns it if not nil, else returns def.
func StringPtrDerefOr ¶
StringPtrDerefOr dereference the string ptr and returns it if not nil, else returns def.
Types ¶
This section is empty.