pointer

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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 BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to a bool

func Float32Ptr

func Float32Ptr(i float32) *float32

Float32Ptr returns a pointer to the passed float32.

func Float64Ptr

func Float64Ptr(i float64) *float64

Float64Ptr returns a pointer to the passed float64.

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a pointer to an int32

func Int32PtrDerefOr

func Int32PtrDerefOr(ptr *int32, def int32) int32

Int32PtrDerefOr dereference the int32 ptr and returns it if not nil, else returns def.

func Int64Ptr

func Int64Ptr(i int64) *int64

Int64Ptr returns a pointer to an int64

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to the passed string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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