Documentation ¶
Index ¶
- func CleanerNanoid(n int) (string, error)
- func CleanerNanoidOrDie(n int) string
- func DefaultIfNil[T any](v *T, defaultVal ...T) T
- func First[T any](items []T) T
- func FxErrorHandler() fx.Option
- func GVK(apiVersion string, kind string) schema.GroupVersionKind
- func GenReadableName(seed string, maxMatchLen ...int) string
- func GenValidK8sResourceNames(seed string, count int) []string
- func IsNil[T any](v T) bool
- func IsValidK8sResourceName(name string) bool
- func JsonConversion(from any, to any) error
- func JsonConvert[T any](from any) (T, error)
- func JsonConvertP[T any](from any) (*T, error)
- func K8sObjToMap(obj client.Object) (map[string]any, error)
- func K8sObjToYAML(obj client.Object) ([]byte, error)
- func Must[T any](value T, err error) T
- func NN(namespace, name string) types.NamespacedName
- func New[T any](v T) *T
- func NewTypeFromPointer[T any]() T
- func ParseOnlyOption[T any](item []T) *T
- func Reduce[T any, V any](items []T, reducerFn func(V, T), value V) V
- func RegularPlural(singular string) string
- func StringReverse(x string) string
- func ToBase64StringFromJson(v interface{}) (string, error)
- func ToBase64UrlFromJson(v interface{}) (string, error)
- func UUID(size ...int) string
- type ErrH
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanerNanoid ¶
func CleanerNanoidOrDie ¶
func DefaultIfNil ¶
func DefaultIfNil[T any](v *T, defaultVal ...T) T
func FxErrorHandler ¶
func GenReadableName ¶
GenReadableName generates a readable name from a given string (seed). It finds matches in the seed following regex `^([[:lower:]]|[[:digit:]]|-)*`. It also limits maximum match text length to 20 (by default)
func GenValidK8sResourceNames ¶
TODO (nxtcoder17): need to benchmark this function
func IsValidK8sResourceName ¶
func JsonConversion ¶
func JsonConvert ¶
func JsonConvertP ¶
func NN ¶
func NN(namespace, name string) types.NamespacedName
func NewTypeFromPointer ¶
func NewTypeFromPointer[T any]() T
func ParseOnlyOption ¶
func ParseOnlyOption[T any](item []T) *T
func RegularPlural ¶
RegularPlural is copied from https://github.com/kubernetes-sigs/kubebuilder/blob/afce6a0e8c2a6d5682be07bbe502e728dd619714/pkg/model/resource/utils.go#L71
func StringReverse ¶
func ToBase64StringFromJson ¶
func ToBase64UrlFromJson ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.