Documentation ¶
Index ¶
- Variables
- func GetFloat32[K comparable](values map[K]any, key K) (float32, error)
- func GetFloat32Default[K comparable](values map[K]any, key K, defaultValue float32) float32
- func GetFloat64[K comparable](values map[K]any, key K) (float64, error)
- func GetFloat64Default[K comparable](values map[K]any, key K, defaultValue float64) float64
- func GetInt[K comparable](values map[K]any, key K) (int, error)
- func GetInt32[K comparable](values map[K]any, key K) (int32, error)
- func GetInt32Default[K comparable](values map[K]any, key K, defaultValue int32) int32
- func GetInt64[K comparable](values map[K]any, key K) (int64, error)
- func GetInt64Default[K comparable](values map[K]any, key K, defaultValue int64) int64
- func GetIntDefault[K comparable](values map[K]any, key K, defaultValue int) int
- func GetString[K comparable](values map[K]any, key K) (string, error)
- func GetStringDefault[K comparable](values map[K]any, key K, defaultValue string) string
- func GetStringSlice[K comparable](values map[K]any, key K) ([]string, error)
- func GetStringSliceDefault[K comparable](values map[K]any, key K, defaultValue []string) []string
- func GetTime[K comparable](values map[K]any, key K) (time.Time, error)
- func KeyStringToInterface(i map[string]any) map[any]any
- func ToJSONMap(i any) any
Constants ¶
This section is empty.
Variables ¶
var ErrKeyCanNotBeTypeAsserted = errors.New("key could not be type asserted")
ErrKeyCanNotBeTypeAsserted is returned when the key can not be type asserted.
var ErrKeyDoesNotExist = errors.New("key is not present in map")
ErrKeyDoesNotExist is returned when the key does not exist in the map.
Functions ¶
func GetFloat32 ¶
func GetFloat32[K comparable](values map[K]any, key K) (float32, error)
GetFloat32 returns a float32 for a given key in values.
func GetFloat32Default ¶ added in v0.0.52
func GetFloat32Default[K comparable](values map[K]any, key K, defaultValue float32) float32
GetFloat32Default returns a float32 or the default value for a given key in values.
func GetFloat64 ¶
func GetFloat64[K comparable](values map[K]any, key K) (float64, error)
GetFloat64 returns a float64 for a given key in values.
func GetFloat64Default ¶ added in v0.0.52
func GetFloat64Default[K comparable](values map[K]any, key K, defaultValue float64) float64
GetFloat64Default returns a float64 or the default value for a given key in values.
func GetInt ¶
func GetInt[K comparable](values map[K]any, key K) (int, error)
GetInt returns an int for a given key in values.
func GetInt32 ¶
func GetInt32[K comparable](values map[K]any, key K) (int32, error)
GetInt32 returns an int32 for a given key in values.
func GetInt32Default ¶ added in v0.0.52
func GetInt32Default[K comparable](values map[K]any, key K, defaultValue int32) int32
GetInt32Default returns a int32 or the default value for a given key in values.
func GetInt64 ¶
func GetInt64[K comparable](values map[K]any, key K) (int64, error)
GetInt64 returns an int64 for a given key in values.
func GetInt64Default ¶ added in v0.0.52
func GetInt64Default[K comparable](values map[K]any, key K, defaultValue int64) int64
GetInt64Default returns a int64 or the default value for a given key in values.
func GetIntDefault ¶ added in v0.0.52
func GetIntDefault[K comparable](values map[K]any, key K, defaultValue int) int
GetIntDefault returns a int or the default value for a given key in values.
func GetString ¶
func GetString[K comparable](values map[K]any, key K) (string, error)
GetString returns a string for a given key in values.
func GetStringDefault ¶
func GetStringDefault[K comparable](values map[K]any, key K, defaultValue string) string
GetStringDefault returns a string or the default value for a given key in values.
func GetStringSlice ¶
func GetStringSlice[K comparable](values map[K]any, key K) ([]string, error)
GetStringSlice returns a string slice for a given key in values.
func GetStringSliceDefault ¶
func GetStringSliceDefault[K comparable](values map[K]any, key K, defaultValue []string) []string
GetStringSliceDefault returns a string slice or the default value for a given key in values.
func GetTime ¶
func GetTime[K comparable](values map[K]any, key K) (time.Time, error)
GetTime returns a string slice for a given key in values.
func KeyStringToInterface ¶ added in v0.0.48
KeyStringToInterface converts map[string]any to map[any]any Deprecated: with generics, this should not be necessary anymore.
Types ¶
This section is empty.