Documentation
¶
Index ¶
- Variables
- func CoerceExact[T any](v any) (T, error)
- func CoerceExactPtr[T any](v any) (*T, error)
- func Get[T any](d Dict, key string, cfn CoerceValueFunc[T]) (T, error)
- func GetExact[T any](d Dict, key string) (T, error)
- func GetExactPtr[T any](d Dict, key string) (*T, error)
- func GetNonZeroComparableOr[T comparable](d Dict, key string, cfn CoerceValueFunc[T], or T) T
- func GetOr[T any](d Dict, key string, cfn CoerceValueFunc[T], or T) T
- func GetPtr[T any](d Dict, key string, cfn CoercePtrFunc[T]) (*T, error)
- func GetSlice[T any](cfn CoerceValueFunc[T]) func(any) ([]T, error)
- func GetSlicePtr[T any](cfn CoercePtrFunc[T]) func(any) ([]*T, error)
- func MustGet[T any](d Dict, key string, cfn CoerceValueFunc[T]) T
- func MustGetExact[T any](d Dict, key string) T
- func MustGetExactPtr[T any](d Dict, key string) *T
- func MustGetPtr[T any](d Dict, key string, cfn CoercePtrFunc[T]) *T
- type CoercePtrFunc
- type CoerceValueFunc
- type Dict
- func (d Dict) GetBool(key string) (bool, error)
- func (d Dict) GetBoolOr(key string, def bool) bool
- func (d Dict) GetDict(key string) (Dict, error)
- func (d Dict) GetDictOr(key string, def Dict) Dict
- func (d Dict) GetDuration(key string) (time.Duration, error)
- func (d Dict) GetDurationOr(key string, def time.Duration) time.Duration
- func (d Dict) GetInt(key string) (int, error)
- func (d Dict) GetIntOr(key string, def int) int
- func (d Dict) GetInts(key string) ([]int, error)
- func (d Dict) GetIntsOr(key string, def []int) []int
- func (d Dict) GetString(key string) (string, error)
- func (d Dict) GetStringOr(key string, def string) string
- func (d Dict) GetStrings(key string) ([]string, error)
- func (d Dict) GetStringsOr(key string, def []string) []string
- func (d Dict) MustGetBool(key string) bool
- func (d Dict) MustGetDict(key string) Dict
- func (d Dict) MustGetDuration(key string) time.Duration
- func (d Dict) MustGetInt(key string) int
- func (d Dict) MustGetInts(key string) []int
- func (d Dict) MustGetString(key string) string
- func (d Dict) MustGetStrings(key string) []string
- func (d Dict) ShallowMerge(other Dict) Dict
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CoerceExact ¶
func CoerceExactPtr ¶
func GetNonZeroComparableOr ¶
func GetNonZeroComparableOr[T comparable](d Dict, key string, cfn CoerceValueFunc[T], or T) T
GetNonZeroComparableOr is significantly different from GetOr in that it considers a comparable's zero-val to be "empty", thus returning the value provided to "or".
This is an important distinction.
func GetSlicePtr ¶
func MustGetExact ¶
func MustGetExactPtr ¶
func MustGetPtr ¶
Types ¶
type CoercePtrFunc ¶
type CoerceValueFunc ¶
type Dict ¶
func UnmarshalJSON ¶
func (Dict) GetDurationOr ¶
func (Dict) MustGetBool ¶
func (Dict) MustGetDict ¶
func (Dict) MustGetInt ¶
func (Dict) MustGetInts ¶
func (Dict) MustGetString ¶
func (Dict) MustGetStrings ¶
func (Dict) ShallowMerge ¶
ShallowMerge clones the local Dict, overwriting any / all top-level keys with values from "other". This does _not_ recursively merge nested structures.
Click to show internal directories.
Click to hide internal directories.