Documentation ¶
Index ¶
- func ChunkArray[T any](input []T, chunkSize int) [][]T
- func Coalesce[T any](values ...*T) *T
- func CoalesceArray[T any, A []T](values ...A) A
- func CoalesceWithFunc[T any, PtrT *T](checkFunc CoalesceFunc[PtrT], values ...PtrT) (PtrT, bool)
- func DeepFindInStruct[T interface{}](haystack interface{}) []*T
- func DeepFindInStructAdvanced[T interface{}](haystack interface{}, options *DeepFindInStructOptions) []*T
- func FirstParam[T any, U any](fp T, _ ...U) T
- func IsBlank(str *string) bool
- func IsNilable(v reflect.Value) bool
- func Jsonify(val any) (string, error)
- func JsonifyEscaped(val any) (string, error)
- func JsonifyPretty(val any) (string, error)
- func JsonifyPrettyEscaped(val any) (string, error)
- func LongestCommonPrefix(strs []string) string
- func Must[T any](v T, err error) T
- func MustCoalesce[T any](values ...*T) *T
- func Ptr[T any](v T) *T
- func ShouldCoalesce[T any](values ...*T) (*T, error)
- func StrArrayToInterArray[T ~string](things []T) []interface{}
- func Ternary[T any](expr bool, trueVal T, falseVal T) T
- type CoalesceFunc
- type DeepFindInStructOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkArray ¶
func CoalesceArray ¶ added in v0.2.0
func CoalesceArray[T any, A []T](values ...A) A
func CoalesceWithFunc ¶
func CoalesceWithFunc[T any, PtrT *T](checkFunc CoalesceFunc[PtrT], values ...PtrT) (PtrT, bool)
Returns the first non-nil element that the provided function returns true for
func DeepFindInStruct ¶
func DeepFindInStruct[T interface{}](haystack interface{}) []*T
Must provide a pointer as the haystack See DeepFindInStructAdvanced This version will ignore zero values for structs
func DeepFindInStructAdvanced ¶
func DeepFindInStructAdvanced[T interface{}](haystack interface{}, options *DeepFindInStructOptions) []*T
Must provide a pointer as the haystack
this will recurse into a struct and find all the values of type T within that struct, as well as any child structs
Note: this will stop searching once it finds a match. If you have self-referencing structs, it will not find child structs within a matching struct
func FirstParam ¶
returns the first value of a multi-return statement
func JsonifyEscaped ¶ added in v0.1.0
The default way of json marshal, encodes < > &
func JsonifyPretty ¶
func JsonifyPrettyEscaped ¶ added in v0.2.0
func LongestCommonPrefix ¶ added in v0.3.0
func MustCoalesce ¶
func MustCoalesce[T any](values ...*T) *T
func ShouldCoalesce ¶
func StrArrayToInterArray ¶
func StrArrayToInterArray[T ~string](things []T) []interface{}
This is used to allow the AWS Enum string lists to be cast to an array of interfaces used for JSONSchema
Types ¶
type CoalesceFunc ¶
type DeepFindInStructOptions ¶
type DeepFindInStructOptions struct { // If true, this will return struct VALUE fields that have a zero value for the requested type // By default if you have a value field (vs a pointer field), with a zero struct value, // it will not be returned as it is assumed to have not been provided IncludeZeroStruct bool }