mapping

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package mapping provides utilities for accessing generic maps with string keys, e.g. created by parsing a YAML or JSON string, message payloads, or fields in logging or testing messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapIterator

func MapIterator(data []interface{}) (func() bool, func() Map)

func StrIterator

func StrIterator(data []interface{}) (func() bool, func() string)

Types

type Map

type Map map[string]interface{}

func (Map) GetList

func (m Map) GetList(key string) []interface{}

func (Map) GetMap

func (m Map) GetMap(key string) Map

func (Map) GetStr

func (m Map) GetStr(key string) string

func (Map) GetStrDef

func (m Map) GetStrDef(key, def string) string

func (Map) GetStrDefGlob

func (m Map) GetStrDefGlob(key, def string) string

GetStrDefGlob: If key not found return default. If found expand global variable reference ($$...$$) in value.

func (Map) GetStrDefGlob1

func (m Map) GetStrDefGlob1(key, def string) string

GetStrDefGlob1: If key not found try to look it up in global vars. If found expand global variable reference in value.

func (Map) GetStrDefGlob2

func (m Map) GetStrDefGlob2(key, keyglob, def string) string

GetStrDefGlob2: If key not found try to look it up in global vars using the special key given as second parameter. If found expand global variable reference in value.

func (Map) GetStrList

func (m Map) GetStrList(key string) []string

func (Map) IterateMap

func (m Map) IterateMap(key string, fct func(Map))

func (Map) IterateStr

func (m Map) IterateStr(key string, fct func(string))

type Vars

type Vars interface {
	Get(string) (string, bool)
	Set(string, string)
}
var GlobalVars Vars = VarsMap{}

type VarsMap

type VarsMap map[string]string

func (VarsMap) Get

func (vm VarsMap) Get(key string) (string, bool)

func (VarsMap) Set

func (vm VarsMap) Set(key, value string)

Jump to

Keyboard shortcuts

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