factorymap

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMap

func NewMap() factory.Factory

NewMap creates and returns a new factory Map.

Types

type Map

type Map map[string]factory.NewFunc

Map is the default Factory implementation. It can be initialized using the `Register` method, by literal map initialization, or both.

func (Map) New

func (fm Map) New(cfg *factory.Config, dependencies factory.Dependencies, out interface{}) error

New sets the `out` parameter to a new instance of the specific object type. `out` should be a pointer to a value able to contain the expected type.

func (Map) Register

func (fm Map) Register(objectType string, fn factory.NewFunc) error

Register registers a new object type the factory can create. Attempting to register an object type that already exists will result in an ErrFactoryTypeAlreadyExists error.

Jump to

Keyboard shortcuts

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