pointer

package
v0.47.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolValue

func BoolValue(v *bool) bool

BoolValue calls underlying aws ToBool

func Int32Value

func Int32Value(v *int32) int32

Int32Value converts the supplied int32 pointer to a int32, returning 0 if the pointer is nil.

func Int64Value

func Int64Value(v *int64) int64

Int64Value converts the supplied int64 pointer to a int64, returning 0 if the pointer is nil.

func LateInitialize

func LateInitialize[T comparable](current, from T) T

LateInitialize return from if current matches the default value of T. Otherwise it returns current.

func LateInitializeIntFrom32Ptr

func LateInitializeIntFrom32Ptr(in *int, from *int32) *int

LateInitializeIntFrom32Ptr returns in if it's non-nil, otherwise returns from which is the backup for the cases in is nil. This function considered that nil and 0 values are same. However, for a *int32, nil and 0 values must be different because if the external AWS resource has a field with 0 value, during late initialization setting this value in CR must be allowed. Please see the LateInitializeIntFromInt32Ptr func.

func LateInitializeIntFromInt32Ptr

func LateInitializeIntFromInt32Ptr(in *int, from *int32) *int

LateInitializeIntFromInt32Ptr returns in if it's non-nil, otherwise returns from which is the backup for the cases in is nil.

func LateInitializeSlice

func LateInitializeSlice[T any](current, from []T) []T

LateInitializeSlice returns from if current is nil and from is not empty. Otherwise it returns current.

func LateInitializeTimePtr

func LateInitializeTimePtr(in *metav1.Time, from *time.Time) *metav1.Time

LateInitializeTimePtr returns in if it's non-nil, otherwise returns from which is the backup for the cases in is nil.

func LateInitializeValueFromPtr

func LateInitializeValueFromPtr[T comparable](current T, from *T) T

LateInitializeValueFromPtr returns from if current matches the default value of T. Otherwise it returns from or the default value if from is nil as well.

func SlicePtrToValue

func SlicePtrToValue[T any](slice []*T) []T

SlicePtrToValue converts a slice of pointers to a slice of its respective values.

func SliceValueToPtr

func SliceValueToPtr[T any](slice []T) []*T

SliceValueToPtr converts a slice of values to a slice of pointers.

func StringValue

func StringValue(v *string) string

StringValue converts the supplied string pointer to a string, returning the empty string if the pointer is nil. TODO(muvaf): is this really meaningful? why not implement it?

func TimeToMetaTime

func TimeToMetaTime(t *time.Time) *metav1.Time

TimeToMetaTime converts a standard Go time.Time to a K8s metav1.Time.

func ToInt32FromIntPtr

func ToInt32FromIntPtr(v *int32) *int

ToInt32FromIntPtr converts an int32 pointer to an int pointer.

func ToIntAsInt32

func ToIntAsInt32(v int) *int32

Int32 converts the supplied int for use with the AWS Go SDK.

func ToIntAsInt32Ptr

func ToIntAsInt32Ptr(v *int) *int32

Int32Address returns the given *int in the form of *int32.

func ToIntAsInt64

func ToIntAsInt64(v int) *int64

Int64 converts the supplied int for use with the AWS Go SDK.

func ToOrNilIfZeroValue

func ToOrNilIfZeroValue[T comparable](val T) *T

ToOrNilIfZeroValue returns a pointer to val if it does NOT match the default value of T. Otherwise it returns nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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