registry

package
Version: v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 2 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NameForType

func NameForType(i interface{}) (string, bool)

NameForType retrieves the name registered for a type. If no name was registered for the given type, the second value will be false

func NewByName

func NewByName(name string) (interface{}, bool)

NewByName creates a new value by the name it was registered under. If no type was registered at the given name, the second value will be false

func Register

func Register(name string, i interface{}, reverse ...interface{})

Register a type in the global registry

func RegisterReverse

func RegisterReverse(i interface{}, name string)

RegisterReverse registers a name in the global registry

Types

type Registry

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

Registry for importable types

func New

func New() *Registry

New creates a new Registry

func (*Registry) NameForType

func (r *Registry) NameForType(i interface{}) (string, bool)

NameForType retrieves the name registered for a type. If no name was registered for the given type, the second value will be false

func (*Registry) NewByName

func (r *Registry) NewByName(name string) (interface{}, bool)

NewByName creates a new value by the name it was registered under. If no type was registered at the given name, the second value will be false

func (*Registry) Register

func (r *Registry) Register(name string, i interface{}, reverse ...interface{}) error

Register a new type by import name

func (*Registry) RegisterReverse

func (r *Registry) RegisterReverse(i interface{}, name string) error

RegisterReverse registers a name in reverse

Source Files

Jump to

Keyboard shortcuts

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