...

Package mapx

import "github.com/ory/x/mapx"
Overview
Index

Overview ▾

Index ▾

Variables
func GetFloat32(values map[interface{}]interface{}, key interface{}) (float32, error)
func GetFloat32Default(values map[interface{}]interface{}, key interface{}, defaultValue float32) float32
func GetFloat64(values map[interface{}]interface{}, key interface{}) (float64, error)
func GetFloat64Default(values map[interface{}]interface{}, key interface{}, defaultValue float64) float64
func GetInt(values map[interface{}]interface{}, key interface{}) (int, error)
func GetInt32(values map[interface{}]interface{}, key interface{}) (int32, error)
func GetInt32Default(values map[interface{}]interface{}, key interface{}, defaultValue int32) int32
func GetInt64(values map[interface{}]interface{}, key interface{}) (int64, error)
func GetInt64Default(values map[interface{}]interface{}, key interface{}, defaultValue int64) int64
func GetIntDefault(values map[interface{}]interface{}, key interface{}, defaultValue int) int
func GetString(values map[interface{}]interface{}, key interface{}) (string, error)
func GetStringDefault(values map[interface{}]interface{}, key interface{}, defaultValue string) string
func GetStringSlice(values map[interface{}]interface{}, key interface{}) ([]string, error)
func GetStringSliceDefault(values map[interface{}]interface{}, key interface{}, defaultValue []string) []string
func GetTime(values map[interface{}]interface{}, key interface{}) (time.Time, error)
func KeyStringToInterface(i map[string]interface{}) map[interface{}]interface{}
func ToJSONMap(i interface{}) interface{}

Package files

type_assert.go

Variables

ErrKeyCanNotBeTypeAsserted is returned when the key can not be type asserted.

var ErrKeyCanNotBeTypeAsserted = errors.New("key could not be type asserted")

ErrKeyDoesNotExist is returned when the key does not exist in the map.

var ErrKeyDoesNotExist = errors.New("key is not present in map")

func GetFloat32

func GetFloat32(values map[interface{}]interface{}, key interface{}) (float32, error)

GetFloat32 returns a float32 for a given key in values.

func GetFloat32Default

func GetFloat32Default(values map[interface{}]interface{}, key interface{}, defaultValue float32) float32

GetFloat32Default returns a float32 or the default value for a given key in values.

func GetFloat64

func GetFloat64(values map[interface{}]interface{}, key interface{}) (float64, error)

GetFloat64 returns a float64 for a given key in values.

func GetFloat64Default

func GetFloat64Default(values map[interface{}]interface{}, key interface{}, defaultValue float64) float64

GetFloat64Default returns a float64 or the default value for a given key in values.

func GetInt

func GetInt(values map[interface{}]interface{}, key interface{}) (int, error)

GetInt returns an int for a given key in values.

func GetInt32

func GetInt32(values map[interface{}]interface{}, key interface{}) (int32, error)

GetInt32 returns an int32 for a given key in values.

func GetInt32Default

func GetInt32Default(values map[interface{}]interface{}, key interface{}, defaultValue int32) int32

GetInt32Default returns a int32 or the default value for a given key in values.

func GetInt64

func GetInt64(values map[interface{}]interface{}, key interface{}) (int64, error)

GetInt64 returns an int64 for a given key in values.

func GetInt64Default

func GetInt64Default(values map[interface{}]interface{}, key interface{}, defaultValue int64) int64

GetInt64Default returns a int64 or the default value for a given key in values.

func GetIntDefault

func GetIntDefault(values map[interface{}]interface{}, key interface{}, defaultValue int) int

GetIntDefault returns a int or the default value for a given key in values.

func GetString

func GetString(values map[interface{}]interface{}, key interface{}) (string, error)

GetString returns a string for a given key in values.

func GetStringDefault

func GetStringDefault(values map[interface{}]interface{}, key interface{}, defaultValue string) string

GetStringDefault returns a string or the default value for a given key in values.

func GetStringSlice

func GetStringSlice(values map[interface{}]interface{}, key interface{}) ([]string, error)

GetStringSlice returns a string slice for a given key in values.

func GetStringSliceDefault

func GetStringSliceDefault(values map[interface{}]interface{}, key interface{}, defaultValue []string) []string

GetStringSliceDefault returns a string slice or the default value for a given key in values.

func GetTime

func GetTime(values map[interface{}]interface{}, key interface{}) (time.Time, error)

GetTime returns a string slice for a given key in values.

func KeyStringToInterface

func KeyStringToInterface(i map[string]interface{}) map[interface{}]interface{}

KeyStringToInterface converts map[string]interface{} to map[interface{}]interface{}

func ToJSONMap

func ToJSONMap(i interface{}) interface{}

ToJSONMap converts all map[interface{}]interface{} occurrences (nested as well) to map[string]interface{}.