maputil

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetByPath

func GetByPath(key string, mp map[string]interface{}) (val interface{}, ok bool)

GetByPath get value from a map[string]interface{}. eg "top" "top.sub"

func HttpQueryString added in v0.4.1

func HttpQueryString(data map[string]interface{}) string

HttpQueryString convert map[string]interface{} data to http query string.

func KeyToLower

func KeyToLower(src map[string]string) map[string]string

KeyToLower convert keys to lower case.

func Keys

func Keys(mp interface{}) (keys []string)

Keys get all keys of the given map.

func MergeStringMap

func MergeStringMap(src, dst map[string]string, ignoreCase bool) map[string]string

MergeStringMap simple merge two string map. merge src to dst map

func ToStringMap added in v0.4.1

func ToStringMap(src map[string]interface{}) map[string]string

ToStringMap convert map[string]interface{} to map[string]string

func Values

func Values(mp interface{}) (values []interface{})

Values get all values from the given map.

Types

type Aliases added in v0.4.1

type Aliases map[string]string

Aliases implemented an simple string alias map.

func (Aliases) AddAlias added in v0.4.1

func (as Aliases) AddAlias(real, alias string)

AddAlias to the Aliases

func (Aliases) AddAliasMap added in v0.4.1

func (as Aliases) AddAliasMap(alias2real map[string]string)

AddAliasMap to the Aliases

func (Aliases) AddAliases added in v0.4.1

func (as Aliases) AddAliases(real string, aliases []string)

AddAliases to the Aliases

func (Aliases) HasAlias added in v0.4.1

func (as Aliases) HasAlias(alias string) bool

HasAlias in the Aliases

func (Aliases) ResolveAlias added in v0.4.1

func (as Aliases) ResolveAlias(alias string) string

ResolveAlias by given name.

type Data added in v0.4.1

type Data map[string]interface{}

Data an map data type

func (Data) Bool added in v0.4.1

func (d Data) Bool(key string) bool

Bool value get

func (Data) Default added in v0.4.1

func (d Data) Default(key string, def interface{}) interface{}

Default get value from the data map with default value

func (Data) Get added in v0.4.1

func (d Data) Get(key string) interface{}

Get value from the data map

func (Data) Has added in v0.4.1

func (d Data) Has(key string) bool

Has value on the data map

func (Data) Int added in v0.4.1

func (d Data) Int(key string) int

Int value get

func (Data) Int64 added in v0.4.1

func (d Data) Int64(key string) int64

Int64 value get

func (Data) Set added in v0.4.1

func (d Data) Set(key string, val interface{})

Set value to the data map

func (Data) Str added in v0.4.1

func (d Data) Str(key string) string

Str value get by key

func (Data) String added in v0.4.1

func (d Data) String() string

String data to string

func (Data) StringMap added in v0.4.1

func (d Data) StringMap() map[string]string

StringMap convert to map[string]string

type SMap added in v0.4.1

type SMap map[string]string

SMap is alias of map[string]string

func (SMap) Bool added in v0.4.1

func (m SMap) Bool(key string) bool

Bool value get

func (SMap) Has added in v0.4.1

func (m SMap) Has(key string) bool

Has kay on the data map

func (SMap) HasValue added in v0.4.1

func (m SMap) HasValue(val string) bool

HasValue on the data map

func (SMap) Int added in v0.4.1

func (m SMap) Int(key string) int

Int value get

func (SMap) Int64 added in v0.4.1

func (m SMap) Int64(key string) int64

Int64 value get

func (SMap) Ints added in v0.4.1

func (m SMap) Ints(key string) []int

Ints value to []int

func (SMap) Str added in v0.4.1

func (m SMap) Str(key string) string

Str value get

func (SMap) String added in v0.4.1

func (m SMap) String() string

String data to string

func (SMap) Strings added in v0.4.1

func (m SMap) Strings(key string) (ss []string)

Strings value to []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL