Documentation
¶
Index ¶
- func DerefOr[T any](p *T, defVal T) T
- func DerefOrZero[T any](p *T) T
- func GetConcreteType[T client.Object](obj client.Object) (T, bool)
- func GetConcreteTypeFromList[T client.Object](objects []client.Object) ([]T, error)
- func NormalizeStringSlice(inputList []string) []string
- func ToObject[T client.Object](items []T) []client.Object
- func ToPtr[T any](v T) *T
- func ToValue[T any](v *T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DerefOrZero ¶
func DerefOrZero[T any](p *T) T
DerefOrZero returns the value referenced by p, or the zero-value of the type
func GetConcreteType ¶
GetConcreteType returns the concrete type T from a client.Object if possible. Returns the concrete type and true if successful, zero value and false if not. Example usage:
if sub, ok := GetConcreteType[*v1alpha1.Subscription](obj); ok {
// Use sub.Status, sub.Spec etc
}
if out, ok := GetConcreteType[*v1alpha1.Output](obj); ok {
// Use out.Status, out.Spec etc
}
func GetConcreteTypeFromList ¶
GetConcreteTypeFromList converts a slice of client.Object to a slice of concrete types. Returns an error if any conversion fails. Example usage:
subscriptions, err := GetConcreteTypeFromList[*v1alpha1.Subscription](objectList) outputs, err := GetConcreteTypeFromList[*v1alpha1.Output](objectList)
func NormalizeStringSlice ¶
NormalizeStringSlice takes a slice of strings, removes duplicates, sorts it, and returns the unique sorted slice.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.