Documentation
¶
Index ¶
- func AnyTrue(vals ...bool) bool
- func DefaultName() string
- func DeleteSliceKey(obj interface{}, key string)
- func DiffMaps[K comparable, T any](newVals, oldVals map[K]T) (map[K]T, map[K]T)
- func DisplayName(val string) string
- func ErrsToStrings[T Error](val []T) []string
- func FindMap[K comparable, T comparable](k K, inps ...map[K]T) T
- func First[T comparable](vals ...T) T
- func FirstNonEmptyString(vs ...string) string
- func FromPtrStr(s *string) string
- func GetFakeObj[T any]() T
- func GetTimeDuration(startedAt time.Time, finishedAt time.Time) time.Duration
- func HasAnyPrefix(val string, prefixes ...string) bool
- func IntSliceToStringSlice(vals []interface{}) []string
- func IsJSON(s []byte) bool
- func IsJSONStr(str string) bool
- func MapToKeys[T comparable, V any](in map[T]V) []T
- func MapValuesToSlice(inp map[string]string) []string
- func MergeMap[K comparable, T any](src map[K]T, vals ...map[K]T) map[K]T
- func MergeMaps(a, b map[string]interface{}) map[string]interface{}
- func MergeSlice[T comparable](a, b []T) []T
- func Name(separator string, wordsPerName int) string
- func NewNullBool(val bool) sql.NullBool
- func SliceAfterValue[T comparable](vals []T, val T) []T
- func SliceContains[T comparable](val T, vals []T) bool
- func SliceToGroups[T any](vals []T, grpSize int) [][]T
- func SliceToMap[T comparable, V any](vals []T) map[T]V
- func SliceToMapDefault[T comparable, V any](vals []T, deflt V) map[T]V
- func SliceToStrings[T stringer](val []T) []string
- func StringOneOf(val string, vals ...string) bool
- func StringToMapDecodeHook() mapstructure.DecodeHookFunc
- func StringToNestedMapDecodeHook() mapstructure.DecodeHookFunc
- func StructToMap(obj any) (map[string]string, error)
- func SubMap[K comparable, T any](newVals, oldVals map[K]T) map[K]T
- func SystemName(val string) string
- func ToIntMap[T any](inp map[string]T) map[string]interface{}
- func ToIntSlice[T any](vals []T) []interface{}
- func ToMapstructure(inp interface{}) (map[string]interface{}, error)
- func ToMapstructureWithJSONTag(inp interface{}) (map[string]interface{}, error)
- func ToPtr[T any](v T) *T
- func ToStringMap(inp map[string]interface{}) map[string]string
- func ToStringSlice[T any](vals []T) []string
- func UniqueSlice[T comparable](items []T) []T
- func ValOrDefault[T comparable](val, deflt T) T
- type Error
- type NullString
- type NullTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultName ¶
func DefaultName() string
func DeleteSliceKey ¶
func DeleteSliceKey(obj interface{}, key string)
func DiffMaps ¶
func DiffMaps[K comparable, T any](newVals, oldVals map[K]T) (map[K]T, map[K]T)
DiffMaps returns two additions, the additions that need to be added, and the ones that need to be deleted
func DisplayName ¶
func ErrsToStrings ¶
func FindMap ¶
func FindMap[K comparable, T comparable](k K, inps ...map[K]T) T
func First ¶
func First[T comparable](vals ...T) T
First returns the first non-empty value in the provided slice.
If the type of T is a pointer, the first non-nil value is returned, even if it is a zero value.
func FirstNonEmptyString ¶
func FromPtrStr ¶
FromPtrString safely returns an object from a pointer
func GetFakeObj ¶
func GetFakeObj[T any]() T
GetFakeObj returns a faked instance of type T will panic on error meant exclusively for testing
func GetTimeDuration ¶
func HasAnyPrefix ¶
func IntSliceToStringSlice ¶
func IntSliceToStringSlice(vals []interface{}) []string
func MapToKeys ¶
func MapToKeys[T comparable, V any](in map[T]V) []T
func MapValuesToSlice ¶
func MergeMap ¶
func MergeMap[K comparable, T any](src map[K]T, vals ...map[K]T) map[K]T
func MergeMaps ¶
Merges source and destination map, preferring values from the source map Taken from github.com/helm/pkg/cli/values/options.go
func MergeSlice ¶
func MergeSlice[T comparable](a, b []T) []T
func NewNullBool ¶
func SliceAfterValue ¶
func SliceAfterValue[T comparable](vals []T, val T) []T
func SliceContains ¶
func SliceContains[T comparable](val T, vals []T) bool
func SliceToGroups ¶
SliceToGroups turns a slice into a set of groups, with the group size. If the group size is less than 1, we set it to one.
func SliceToMap ¶
func SliceToMap[T comparable, V any](vals []T) map[T]V
func SliceToMapDefault ¶
func SliceToMapDefault[T comparable, V any](vals []T, deflt V) map[T]V
func SliceToStrings ¶
func SliceToStrings[T stringer](val []T) []string
func StringOneOf ¶
func StringToMapDecodeHook ¶
func StringToMapDecodeHook() mapstructure.DecodeHookFunc
func StringToNestedMapDecodeHook ¶
func StringToNestedMapDecodeHook() mapstructure.DecodeHookFunc
StringToNestedMapDecodeHook decodes input interface into nested map if needed Beta: use with caution, not used anywhere as of now, bugs expected
func SubMap ¶
func SubMap[K comparable, T any](newVals, oldVals map[K]T) map[K]T
func SystemName ¶
func ToIntSlice ¶
func ToIntSlice[T any](vals []T) []interface{}
func ToMapstructure ¶
func ToPtr ¶
func ToPtr[T any](v T) *T
ToPtr generically returns a reference to the value v of type T
func ToStringMap ¶
func ToStringSlice ¶
func UniqueSlice ¶
func UniqueSlice[T comparable](items []T) []T
UniqueSlice takes a slice and returns a deduplicated slice of elements
func ValOrDefault ¶
func ValOrDefault[T comparable](val, deflt T) T
Types ¶
type Error ¶
type Error interface {
Error() string
}
Error interface defines the Error() string method.
type NullString ¶
type NullString struct {
sql.NullString
}
func NewNullString ¶
func NewNullString(val string) NullString
func (NullString) Empty ¶
func (s NullString) Empty() bool
func (NullString) MarshalJSON ¶
func (s NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (s *NullString) UnmarshalJSON(data []byte) error
func (NullString) ValueOrDefault ¶
func (s NullString) ValueOrDefault(def string) string
func (NullString) ValueString ¶
func (s NullString) ValueString() string