maps

package
v0.0.0-...-4970bd5 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: GPL-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach(m map[string]interface{}, fn ForEachFn)

func Get

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

func Gets

func Gets(m map[string]interface{}, keys ...string) (interface{}, error)

func Merge

func Merge(a, b map[string]interface{}, strategy Mapper) map[string]interface{}

Merge will merge 'a' and 'b'. with optional strategy mapper a will be modifiy to be the result

func Merger

func Merger(a Mapper) *merger

func Set

func Set(m map[string]interface{}, key string, value interface{})

func ToFormatJson

func ToFormatJson(m interface{}) ([]byte, error)

func ToJson

func ToJson(m interface{}) ([]byte, error)

func ToKeys

func ToKeys(key string) []string

func ToStruct

func ToStruct(m map[string]interface{}, target interface{}) error

Types

type ForEachFn

type ForEachFn func(key string, value interface{})

type Mapper

type Mapper map[string]interface{}

func Copy

func Copy(m map[string]interface{}) Mapper

func FromJson

func FromJson(content []byte) (Mapper, error)

func New

func New() Mapper

func Normalize

func Normalize(input Mapper, removed []string) Mapper

Normalize will remove key listed in removed. warning: input will be mutation to remove data if you don't want that, copy first.

func ToMapper

func ToMapper(d interface{}) (Mapper, bool)

func (Mapper) A

func (m Mapper) A(key string) ([]interface{}, bool)

func (Mapper) Ae

func (m Mapper) Ae(key string) ([]interface{}, error)

func (Mapper) Ai

func (m Mapper) Ai(key string) []interface{}

func (Mapper) Ao

func (m Mapper) Ao(key string, i []interface{}) []interface{}

func (Mapper) B

func (m Mapper) B(key string) (bool, bool)

func (Mapper) Be

func (m Mapper) Be(key string) (bool, error)

func (Mapper) Bi

func (m Mapper) Bi(key string) bool

func (Mapper) Bo

func (m Mapper) Bo(key string, i bool) bool

func (Mapper) Copy

func (m Mapper) Copy() Mapper

func (Mapper) F

func (m Mapper) F(key string) (float64, bool)

func (Mapper) Fe

func (m Mapper) Fe(key string) (float64, error)

func (Mapper) Fi

func (m Mapper) Fi(key string) float64

func (Mapper) Fo

func (m Mapper) Fo(key string, i float64) float64

func (Mapper) ForEach

func (m Mapper) ForEach(fn ForEachFn)

func (Mapper) Get

func (m Mapper) Get(key string) (interface{}, error)

func (Mapper) Gets

func (m Mapper) Gets(keys ...string) (interface{}, error)

func (Mapper) Has

func (m Mapper) Has(key string) bool

func (Mapper) I

func (m Mapper) I(key string) (int64, bool)

func (Mapper) Ie

func (m Mapper) Ie(key string) (int64, error)

func (Mapper) Ii

func (m Mapper) Ii(key string) int64

func (Mapper) Io

func (m Mapper) Io(key string, i int64) int64

func (Mapper) IsEmpty

func (m Mapper) IsEmpty() bool

func (Mapper) Keys

func (m Mapper) Keys() []string

Keys will return key as dot notation on every map level

func (Mapper) M

func (m Mapper) M(key string) (Mapper, bool)

func (Mapper) Me

func (m Mapper) Me(key string) (Mapper, error)

func (Mapper) Mi

func (m Mapper) Mi(key string) Mapper

func (Mapper) Mo

func (m Mapper) Mo(key string, i Mapper) Mapper

func (Mapper) N

func (m Mapper) N(key string) (float64, bool)

func (Mapper) Ne

func (m Mapper) Ne(key string) (float64, error)

func (Mapper) Ni

func (m Mapper) Ni(key string) float64

func (Mapper) No

func (m Mapper) No(key string, i float64) float64

func (Mapper) S

func (m Mapper) S(key string) (string, bool)

func (Mapper) Se

func (m Mapper) Se(key string) (string, error)

func (Mapper) Set

func (m Mapper) Set(key string, value interface{}) Mapper

func (Mapper) Si

func (m Mapper) Si(key string) string

func (Mapper) Size

func (m Mapper) Size() int

func (Mapper) So

func (m Mapper) So(key string, i string) string

func (Mapper) String

func (m Mapper) String() string

func (Mapper) Struct

func (m Mapper) Struct(target interface{}) error

func (Mapper) Z

func (m Mapper) Z(key string) (interface{}, bool)

func (Mapper) Ze

func (m Mapper) Ze(key string) (interface{}, error)

func (Mapper) Zi

func (m Mapper) Zi(key string) interface{}

func (Mapper) Zo

func (m Mapper) Zo(key string, i interface{}) interface{}

type MergeConfigType

type MergeConfigType uint8
const (
	MERGER_NORMAL MergeConfigType = iota
	MERGER_OVERRIDE
)

Jump to

Keyboard shortcuts

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