mapmap

package
v0.0.0-...-2841839 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 5 Imported by: 0

README

mapmap

import "github.com/cognusion/go-jar/mapmap"

Overview

Index

Package files

mapmap.go

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

Jump to

Keyboard shortcuts

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