Documentation ¶
Index ¶
- type Components
- func (components *Components) Add(component base.Component)
- func (components *Components) CompareAndAdd(component base.Component) bool
- func (components *Components) Get(key string) base.Component
- func (components *Components) GetAll() map[string]base.Component
- func (components *Components) GetAndApply(key string, callback func(component base.Component))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
Components struct is a thread-safe structure mapping for components
func NewComponents ¶
func NewComponents() *Components
NewComponents creates an instance of Components struct
func (*Components) Add ¶
func (components *Components) Add(component base.Component)
Add adds a new component to the component map
func (*Components) CompareAndAdd ¶
func (components *Components) CompareAndAdd(component base.Component) bool
CompareAndAdd compares to see if the component exists in the map. If not, it adds the component. This function is thread-safe.
func (*Components) Get ¶
func (components *Components) Get(key string) base.Component
Get retrieves a new component from the component map
func (*Components) GetAll ¶
func (components *Components) GetAll() map[string]base.Component
GetAll retrieves all the components
func (*Components) GetAndApply ¶
func (components *Components) GetAndApply(key string, callback func(component base.Component))
GetAndApply get a component and apply the callback function inside while locking components
Click to show internal directories.
Click to hide internal directories.