# README
mapmap
import "github.com/cognusion/go-jar/mapmap"
Overview
Index
- type MapMap
- func NewMapMap() *MapMap
- func NewMapMapWithMapNames(idMap, endpointMap string) *MapMap
- func (o *MapMap) Get(name, key string) string
- func (o *MapMap) GetURLRoute(routeName string) *URLRoute
- func (o *MapMap) Load(name, filename string) error
- func (o *MapMap) Set(name string, newmap map[string]string)
- func (o *MapMap) Size() int
- type URLRoute
Package files
type MapMap
type MapMap struct {
sync.Mutex // used ONLY BY WRITERS
// contains filtered or unexported fields
}
MapMap is essentially a goro-safe map[string]map[string]string specialized for handling multi-URL "URL Routes". MapMap is optimized for read-mostly patterns
func NewMapMap
func NewMapMap() *MapMap
NewMapMap returns an initiaized MapMap
func NewMapMapWithMapNames
func NewMapMapWithMapNames(idMap, endpointMap string) *MapMap
NewMapMapWithMapNames returns an initiaized MapMap, with the map names set to non-default values.
func (*MapMap) Get
func (o *MapMap) Get(name, key string) string
Get takes a map name and key, and returns the stored value or an empty string
func (*MapMap) GetURLRoute
func (o *MapMap) GetURLRoute(routeName string) *URLRoute
GetURLRoute takes a routeName (first block of a hostname) and may return a reconstituted URLRoute.
The Name is populated by the routeName
requested.
The ID field is pulled from the value of the ids
map with the routeName
as key.
The Endpoint field is pulled from the value of the endpoints
map with the routeName
as key.
Partial results are returns as applicable.
func (*MapMap) Load
func (o *MapMap) Load(name, filename string) error
Load takes an "Org Map" name and a filename, and builds a new "Org Map" from the file, .Set()ing it
func (*MapMap) Set
func (o *MapMap) Set(name string, newmap map[string]string)
Set takes an "Org Map" name, and replaces its string map with the provided one
func (*MapMap) Size
func (o *MapMap) Size() int
Size returns the number of toplevel keys in the MapMap
type URLRoute
type URLRoute struct {
Name string
ID string
Endpoint string
}
URLRoute is an informative structure
Generated by godoc2md