m

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Utility for map[string]interface{}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeMapParams

func EncodeMapParams(m map[string]interface{}) string

EncodeMapParams sort keys by asc, encode into url string

func FormatURLParam

func FormatURLParam(m map[string]interface{}) (urlParam string)

FormatURLParam convert map into a url.Values

func GetMapValueByKey

func GetMapValueByKey(m map[string]interface{}, key string) (string, error)

GetMapValueByKey get map value by key, marshal non-string type into string

Types

type M

type M map[string]interface{}

func NewMap

func NewMap(f func(m M)) M

NewMap return a new map, pass into a higher order func to setup map

func (M) Set

func (m M) Set(key string, value interface{}, opts ...MapOptions) M

Set set map value by key

if opts(MapOptions) SetIgnoreEmptyString(true),will ignore empty string("")

type MakeMapEndpoint

type MakeMapEndpoint func(M) error

func CombineMakeMapEndpointFunc

func CombineMakeMapEndpointFunc(endpoint ...MakeMapEndpoint) MakeMapEndpoint

CombineMakeMapEndpointFunc combine MakeMapEndpoint func

func MergeMap added in v0.1.3

func MergeMap(source map[string]interface{}) MakeMapEndpoint

type MapOptions

type MapOptions struct {
	IgnoreEmptyString *bool
}

func (*MapOptions) SetIgnoreEmptyString

func (o *MapOptions) SetIgnoreEmptyString(input bool)

Jump to

Keyboard shortcuts

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