Documentation ¶
Index ¶
- func BoolValue(v *bool) bool
- func Int32Value(v *int32) int32
- func Int64Value(v *int64) int64
- func LateInitialize[T comparable](current, from T) T
- func LateInitializeIntFrom32Ptr(in *int, from *int32) *int
- func LateInitializeIntFromInt32Ptr(in *int, from *int32) *int
- func LateInitializeSlice[T any](current, from []T) []T
- func LateInitializeTimePtr(in *metav1.Time, from *time.Time) *metav1.Time
- func LateInitializeValueFromPtr[T comparable](current T, from *T) T
- func SlicePtrToValue[T any](slice []*T) []T
- func SliceValueToPtr[T any](slice []T) []*T
- func StringValue(v *string) string
- func TimeToMetaTime(t *time.Time) *metav1.Time
- func ToInt32FromIntPtr(v *int32) *int
- func ToIntAsInt32(v int) *int32
- func ToIntAsInt32Ptr(v *int) *int32
- func ToIntAsInt64(v int) *int64
- func ToOrNilIfZeroValue[T comparable](val T) *T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Int32Value ¶
Int32Value converts the supplied int32 pointer to a int32, returning 0 if the pointer is nil.
func Int64Value ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
TimeToMetaTime converts a standard Go time.Time to a K8s metav1.Time.
func ToInt32FromIntPtr ¶
ToInt32FromIntPtr converts an int32 pointer to an int pointer.
func ToIntAsInt32 ¶
Int32 converts the supplied int for use with the AWS Go SDK.
func ToIntAsInt32Ptr ¶
Int32Address returns the given *int in the form of *int32.
func ToIntAsInt64 ¶
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.