Documentation ¶
Index ¶
- func Bool(v any) bool
- func Coalesce[M Measurable[any]](args ...M) M
- func Int(v any) int
- func Int64(v any) int64
- func IsCollection(value any) bool
- func JSON(value any) string
- func NumbersCoalesce[T ~int | ~int32 | ~uint | ~uint32 | ~int64 | ~uint64](items ...T) T
- 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) 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) JSON() string
- 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) 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 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