Documentation
¶
Index ¶
- func Bool(v any) bool
- func Coalesce[M Measurable[any]](args ...M) M
- func Float32(v any) float32
- func Float64(v any) float64
- func Int(v any) int
- func Int64(v any) int64
- func IsCollection(value any) bool
- func IsMap(value any) bool
- func IsSlice(value any) bool
- func JSON(value any) string
- func NumbersCoalesce[T ~int | ~int32 | ~uint | ~uint32 | ~int64 | ~uint64](items ...T) T
- func OrderedMapKeys[K constraints.Ordered, V any](m map[K]V) []K
- func RangeOrderedMap[K constraints.Ordered, V any](c map[K]V, f func(k K, v V) bool)
- func Select[T any](cond bool, a, b T) T
- func String(v any) string
- func StringSlice(v any) []string
- func StringsCoalesce(str ...string) string
- func Time(v any) *time.Time
- func UInt64(v any) uint64
- type MapAny
- func (c MapAny) Bool(k string) bool
- func (c MapAny) Extract(path ...string) MapAny
- func (c MapAny) Float32(k string) float32
- func (c MapAny) Float64(k string) float64
- func (c MapAny) GetOrSet(key string, getter func(key string) any) any
- func (c MapAny) Int(k string) int
- func (c MapAny) Int64(k string) int64
- func (c MapAny) IsMap(k string) bool
- func (c MapAny) IsSlice(k string) bool
- func (c MapAny) JSON() string
- func (c MapAny) Map(k string) MapAny
- func (c *MapAny) Merge(m MapAny) *MapAny
- func (c *MapAny) Scan(value any) error
- func (c MapAny) Slice(k string) []any
- func (c MapAny) String(k string) string
- func (c MapAny) StringSlice(k string) []string
- func (c MapAny) Time(k string) *time.Time
- func (c MapAny) To(val any) error
- func (c MapAny) UInt64(k string) uint64
- func (c MapAny) Value() (driver.Value, error)
- func (c MapAny) YAML() string
- type Measurable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce[M Measurable[any]](args ...M) M
Coalesce returns the first non-empty value
func NumbersCoalesce ¶
NumbersCoalesce returns the first value from the supplied list that is not 0, or 0 if there are no values that are not zero
func OrderedMapKeys ¶ added in v0.5.36
func OrderedMapKeys[K constraints.Ordered, V any](m map[K]V) []K
OrderedMapKeys returns ordered keys
func RangeOrderedMap ¶ added in v0.5.36
func RangeOrderedMap[K constraints.Ordered, V any](c map[K]V, f func(k K, v V) bool)
RangeOrderedMap range over ordered map
func StringsCoalesce ¶
StringsCoalesce returns the first non-empty string value
Types ¶
type MapAny ¶
MapAny provides map of values
func FromJSON ¶
FromJSON returns map from json encoded string, this method does not return value on error, as the value is expected a valid JSON string.
func FromYAML ¶
FromYAML returns map from yaml encoded string, this method does not return value on error, as the value is expected a valid YAML string.
func (MapAny) String ¶
String will return the value as a string, if the underlying type is not a string, it will try and co-oerce it to a string.
func (MapAny) StringSlice ¶
StringSlice returns slice of string values
type Measurable ¶
Measurable interface