gera

package
v0.67.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package gera implements a hierarchical key-value store.

A gera.Map uses a map[string]interface{} as backing store, and it can wrap other gera.Map instances. Values in child maps override any value provided by a gera.Map that's wrapped in the hierarchy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenStack

func FlattenStack(stringMaps ...StringMap) (flattened map[string]string, err error)

Types

type Map

type Map interface {
	Wrap(m Map) Map
	IsHierarchyRoot() bool
	HierarchyContains(m Map) bool
	Unwrap() Map

	Has(key string) bool
	Len() int

	Get(key string) (interface{}, bool)
	Set(key string, value interface{}) bool

	Flattened() (map[string]interface{}, error)
	WrappedAndFlattened(m Map) (map[string]interface{}, error)

	Raw() map[string]interface{}
}

func MakeMap

func MakeMap() Map

func MakeMapWithMap

func MakeMapWithMap(fromMap map[string]interface{}) Map

func MakeMapWithMapCopy

func MakeMapWithMapCopy(fromMap map[string]interface{}) Map

type StringMap

type StringMap interface {
	Wrap(m StringMap) StringMap
	IsHierarchyRoot() bool
	HierarchyContains(m StringMap) bool
	Unwrap() StringMap

	Has(key string) bool
	Len() int

	Get(key string) (string, bool)
	Set(key string, value string) bool
	Del(key string) bool

	Flattened() (map[string]string, error)
	FlattenedParent() (map[string]string, error)
	WrappedAndFlattened(m StringMap) (map[string]string, error)

	Raw() map[string]string
	Copy() StringMap
}

type StringWrapMap

type StringWrapMap struct {
	// contains filtered or unexported fields
}

func MakeStringMap

func MakeStringMap() *StringWrapMap

func MakeStringMapWithMap

func MakeStringMapWithMap(fromMap map[string]string) *StringWrapMap

func MakeStringMapWithMapCopy

func MakeStringMapWithMapCopy(fromMap map[string]string) *StringWrapMap

func (*StringWrapMap) Copy

func (w *StringWrapMap) Copy() StringMap

func (*StringWrapMap) Del added in v0.26.2

func (w *StringWrapMap) Del(key string) (ok bool)

func (*StringWrapMap) Flattened

func (w *StringWrapMap) Flattened() (map[string]string, error)

func (*StringWrapMap) FlattenedParent

func (w *StringWrapMap) FlattenedParent() (map[string]string, error)

func (*StringWrapMap) Get

func (w *StringWrapMap) Get(key string) (value string, ok bool)

func (*StringWrapMap) Has

func (w *StringWrapMap) Has(key string) bool

func (*StringWrapMap) HierarchyContains

func (w *StringWrapMap) HierarchyContains(m StringMap) bool

func (*StringWrapMap) IsHierarchyRoot

func (w *StringWrapMap) IsHierarchyRoot() bool

func (*StringWrapMap) Len

func (w *StringWrapMap) Len() int

func (*StringWrapMap) Raw

func (w *StringWrapMap) Raw() map[string]string

func (*StringWrapMap) Set

func (w *StringWrapMap) Set(key string, value string) (ok bool)

func (*StringWrapMap) UnmarshalYAML

func (w *StringWrapMap) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*StringWrapMap) Unwrap

func (w *StringWrapMap) Unwrap() StringMap

Unwraps this map from its parent. Returns a pointer to the former parent which was just unwrapped.

func (*StringWrapMap) Wrap

func (w *StringWrapMap) Wrap(m StringMap) StringMap

Wraps this map around the gera.Map m, which becomes the new parent. Returns a pointer to the composite map (i.e. to itself in its new state).

func (*StringWrapMap) WrappedAndFlattened

func (w *StringWrapMap) WrappedAndFlattened(m StringMap) (map[string]string, error)

type WrapMap

type WrapMap struct {
	// contains filtered or unexported fields
}

func (*WrapMap) Flattened

func (w *WrapMap) Flattened() (map[string]interface{}, error)

func (*WrapMap) Get

func (w *WrapMap) Get(key string) (value interface{}, ok bool)

func (*WrapMap) Has

func (w *WrapMap) Has(key string) bool

func (*WrapMap) HierarchyContains

func (w *WrapMap) HierarchyContains(m Map) bool

func (*WrapMap) IsHierarchyRoot

func (w *WrapMap) IsHierarchyRoot() bool

func (*WrapMap) Len

func (w *WrapMap) Len() int

func (*WrapMap) Raw

func (w *WrapMap) Raw() map[string]interface{}

func (*WrapMap) Set

func (w *WrapMap) Set(key string, value interface{}) (ok bool)

func (*WrapMap) UnmarshalYAML

func (w *WrapMap) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*WrapMap) Unwrap

func (w *WrapMap) Unwrap() Map

Unwraps this map from its parent. Returns a pointer to the former parent which was just unwrapped.

func (*WrapMap) Wrap

func (w *WrapMap) Wrap(m Map) Map

Wraps this map around the gera.Map m, which becomes the new parent. Returns a pointer to the composite map (i.e. to itself in its new state).

func (*WrapMap) WrappedAndFlattened

func (w *WrapMap) WrappedAndFlattened(m Map) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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