Documentation
¶
Overview ¶
Package registry implements a registry design pattern to registry object under a given unique ID string, allowing registered objects to be reached later or from anywhere when a global registry instance is used.
Index ¶
- func Add(name string, object interface{}) (err error)
- func Adds(objects Objects) (err error)
- func Get(name string) (object interface{}, err error)
- func IsEmpty() (value bool)
- func IsExist(name string) (value bool)
- func IsExists(names []string) (value bool)
- func Remove(name string)
- func RemoveAll()
- func Removes(names []string)
- func Set(name string, object interface{})
- func Sets(objects Objects)
- func Size() (value int)
- type Names
- type Objects
- type Registry
- func (r *Registry) Add(name string, object interface{}) error
- func (r *Registry) Adds(objects Objects) error
- func (r *Registry) Get(name string) (object interface{}, err error)
- func (r *Registry) GetAll() Objects
- func (r *Registry) Gets(names []string) (objects Objects, err error)
- func (r *Registry) IsEmpty() bool
- func (r *Registry) IsExist(name string) bool
- func (r *Registry) IsExists(names []string) bool
- func (r *Registry) Remove(name string) *Registry
- func (r *Registry) RemoveAll() *Registry
- func (r *Registry) Removes(names []string) *Registry
- func (r *Registry) Set(name string, object interface{}) *Registry
- func (r *Registry) Sets(objects Objects) *Registry
- func (r *Registry) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEmpty ¶
func IsEmpty() (value bool)
IsEmpty returns true if there are no registered objects, otherwise it returns false.
func IsExist ¶
IsExist returns true if object with given name was registered, otherwise it returns false.
func IsExists ¶
IsExists returns true if all objects with given names were registered, otherwise it returns false.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry defines a registry object that can register objects.
func (*Registry) IsEmpty ¶
IsEmpty returns true if there are no registered objects, otherwise it returns false.
func (*Registry) IsExist ¶
IsExist returns true if object with given name was registered, otherwise it returns false.
func (*Registry) IsExists ¶
IsExists returns true if all objects with given names were registered, otherwise it returns false.