pointer

package
v0.0.0-...-cfd413d Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 3 Imported by: 2,849

README

Pointer

This package provides some functions for pointer-based operations.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolPtr = Bool // for back-compat

BoolPtr is a function variable referring to Bool. Deprecated: Use Bool instead.

View Source
var BoolPtrDerefOr = BoolDeref // for back-compat

BoolPtrDerefOr is a function variable referring to BoolDeref. Deprecated: Use BoolDeref instead.

View Source
var Float32Ptr = Float32

Float32Ptr is a function variable referring to Float32. Deprecated: Use Float32 instead.

View Source
var Float32PtrDerefOr = Float32Deref // for back-compat

Float32PtrDerefOr is a function variable referring to Float32Deref. Deprecated: Use Float32Deref instead.

View Source
var Float64Ptr = Float64

Float64Ptr is a function variable referring to Float64. Deprecated: Use Float64 instead.

View Source
var Float64PtrDerefOr = Float64Deref // for back-compat

Float64PtrDerefOr is a function variable referring to Float64Deref. Deprecated: Use Float64Deref instead.

View Source
var Int32Ptr = Int32 // for back-compat

Int32Ptr is a function variable referring to Int32. Deprecated: Use Int32 instead.

View Source
var Int32PtrDerefOr = Int32Deref // for back-compat

Int32PtrDerefOr is a function variable referring to Int32Deref. Deprecated: Use Int32Deref instead.

View Source
var Int64Ptr = Int64 // for back-compat

Int64Ptr is a function variable referring to Int64. Deprecated: Use Int64 instead.

View Source
var Int64PtrDerefOr = Int64Deref // for back-compat

Int64PtrDerefOr is a function variable referring to Int64Deref. Deprecated: Use Int64Deref instead.

View Source
var IntPtr = Int // for back-compat

IntPtr is a function variable referring to Int. Deprecated: Use Int instead.

View Source
var IntPtrDerefOr = IntDeref // for back-compat

IntPtrDerefOr is a function variable referring to IntDeref. Deprecated: Use IntDeref instead.

View Source
var StringPtr = String // for back-compat

StringPtr is a function variable referring to String. Deprecated: Use String instead.

View Source
var StringPtrDerefOr = StringDeref // for back-compat

StringPtrDerefOr is a function variable referring to StringDeref. Deprecated: Use StringDeref instead.

View Source
var Uint32Ptr = Uint32 // for back-compat

Uint32Ptr is a function variable referring to Uint32. Deprecated: Use Uint32 instead.

View Source
var Uint32PtrDerefOr = Uint32Deref // for back-compat

Uint32PtrDerefOr is a function variable referring to Uint32Deref. Deprecated: Use Uint32Deref instead.

View Source
var Uint64Ptr = Uint64 // for back-compat

Uint64Ptr is a function variable referring to Uint64. Deprecated: Use Uint64 instead.

View Source
var Uint64PtrDerefOr = Uint64Deref // for back-compat

Uint64PtrDerefOr is a function variable referring to Uint64Deref. Deprecated: Use Uint64Deref instead.

View Source
var UintPtr = Uint // for back-compat

UintPtr is a function variable referring to Uint. Deprecated: Use Uint instead.

View Source
var UintPtrDerefOr = UintDeref // for back-compat

UintPtrDerefOr is a function variable referring to UintDeref. Deprecated: Use UintDeref instead.

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 Bool

func Bool(b bool) *bool

Bool returns a pointer to a bool.

func BoolDeref

func BoolDeref(ptr *bool, def bool) bool

BoolDeref dereferences the bool ptr and returns it if not nil, or else returns def.

func BoolEqual

func BoolEqual(a, b *bool) bool

BoolEqual returns true if both arguments are nil or both arguments dereference to the same value.

func Duration

func Duration(d time.Duration) *time.Duration

Duration returns a pointer to a time.Duration.

func DurationDeref

func DurationDeref(ptr *time.Duration, def time.Duration) time.Duration

DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else returns def.

func DurationEqual

func DurationEqual(a, b *time.Duration) bool

DurationEqual returns true if both arguments are nil or both arguments dereference to the same value.

func Float32

func Float32(i float32) *float32

Float32 returns a pointer to a float32.

func Float32Deref

func Float32Deref(ptr *float32, def float32) float32

Float32Deref dereferences the float32 ptr and returns it if not nil, or else returns def.

func Float32Equal

func Float32Equal(a, b *float32) bool

Float32Equal returns true if both arguments are nil or both arguments dereference to the same value.

func Float64

func Float64(i float64) *float64

Float64 returns a pointer to a float64.

func Float64Deref

func Float64Deref(ptr *float64, def float64) float64

Float64Deref dereferences the float64 ptr and returns it if not nil, or else returns def.

func Float64Equal

func Float64Equal(a, b *float64) bool

Float64Equal returns true if both arguments are nil or both arguments dereference to the same value.

func Int

func Int(i int) *int

Int returns a pointer to an int

func Int32

func Int32(i int32) *int32

Int32 returns a pointer to an int32.

func Int32Deref

func Int32Deref(ptr *int32, def int32) int32

Int32Deref dereferences the int32 ptr and returns it if not nil, or else returns def.

func Int32Equal

func Int32Equal(a, b *int32) bool

Int32Equal returns true if both arguments are nil or both arguments dereference to the same value.

func Int64

func Int64(i int64) *int64

Int64 returns a pointer to an int64.

func Int64Deref

func Int64Deref(ptr *int64, def int64) int64

Int64Deref dereferences the int64 ptr and returns it if not nil, or else returns def.

func Int64Equal

func Int64Equal(a, b *int64) bool

Int64Equal returns true if both arguments are nil or both arguments dereference to the same value.

func IntDeref

func IntDeref(ptr *int, def int) int

IntDeref dereferences the int ptr and returns it if not nil, or else returns def.

func String

func String(s string) *string

String returns a pointer to a string.

func StringDeref

func StringDeref(ptr *string, def string) string

StringDeref dereferences the string ptr and returns it if not nil, or else returns def.

func StringEqual

func StringEqual(a, b *string) bool

StringEqual returns true if both arguments are nil or both arguments dereference to the same value.

func Uint

func Uint(i uint) *uint

Uint returns a pointer to an uint

func Uint32

func Uint32(i uint32) *uint32

Uint32 returns a pointer to an uint32.

func Uint32Deref

func Uint32Deref(ptr *uint32, def uint32) uint32

Uint32Deref dereferences the uint32 ptr and returns it if not nil, or else returns def.

func Uint32Equal

func Uint32Equal(a, b *uint32) bool

Uint32Equal returns true if both arguments are nil or both arguments dereference to the same value.

func Uint64

func Uint64(i uint64) *uint64

Uint64 returns a pointer to an uint64.

func Uint64Deref

func Uint64Deref(ptr *uint64, def uint64) uint64

Uint64Deref dereferences the uint64 ptr and returns it if not nil, or else returns def.

func Uint64Equal

func Uint64Equal(a, b *uint64) bool

Uint64Equal returns true if both arguments are nil or both arguments dereference to the same value.

func UintDeref

func UintDeref(ptr *uint, def uint) uint

UintDeref dereferences the uint ptr and returns it if not nil, or else returns def.

Types

This section is empty.

Jump to

Keyboard shortcuts

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