register

package
v1.0.1-wildcard Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package register offers tools for creating and managing registers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Namespaced

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

Namespaced is a register able to keep track of elements stored under namespaces and keys

func New

func New() *Namespaced

New returns an initialized Namespaced register

func (*Namespaced) AddNamespace

func (n *Namespaced) AddNamespace(namespace string)

AddNamespace adds a new, empty Untyped register under the give namespace (if it did not exist)

func (*Namespaced) Get

func (n *Namespaced) Get(namespace string) (*Untyped, bool)

Get returns the Untyped register stored under the namespace

func (*Namespaced) Register

func (n *Namespaced) Register(namespace, name string, v interface{})

Register stores v at the key name of the Untyped register named namespace

type Untyped

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

Untyped is a simple register, safe for concurrent access

func NewUntyped

func NewUntyped() *Untyped

NewUntyped returns an empty Untyped register

func (*Untyped) Clone

func (u *Untyped) Clone() map[string]interface{}

Clone returns a snapshot of the register

func (*Untyped) Get

func (u *Untyped) Get(name string) (interface{}, bool)

Get returns the value stored at the key name

func (*Untyped) Register

func (u *Untyped) Register(name string, v interface{})

Register stores v under the key name

Jump to

Keyboard shortcuts

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