Documentation ¶
Index ¶
Constants ¶
const ( Logger = "Logger" SensuRepository = "SensuRepository" SlackRepository = "SlackRepository" TelegramRepository = "TelegramRepository" GoogleChatRepository = "GoogleChatRepository" AlertManagerRepository = "AlertManagerRepository" OpsgenieRepository = "OpsgenieRepository" )
List of consts containing the names of the available components in the Application Context - appcontext.Current (Add your component names here as constants)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationContext ¶
type ApplicationContext struct {
// contains filtered or unexported fields
}
ApplicationContext is the type defining a map of Components
var Current ApplicationContext
Current keeps all components available, initialized in the application startup
func CreateApplicationContext ¶
func CreateApplicationContext() ApplicationContext
CreateApplicationContext creates a new ApplicationContext instance
func (*ApplicationContext) Add ¶
func (applicationContext *ApplicationContext) Add(componentName string, componentInitializerFunction ComponentInitializerFunction)
Add a component By Name
func (*ApplicationContext) Count ¶
func (applicationContext *ApplicationContext) Count() int
Count returns the count of components registered
func (*ApplicationContext) Delete ¶
func (applicationContext *ApplicationContext) Delete(componentName string)
Delete a component By Name
func (*ApplicationContext) Get ¶
func (applicationContext *ApplicationContext) Get(componentName string) Component
Get a component By Name
type ComponentInfo ¶
type ComponentInfo struct { Initializer ComponentInitializerFunction Instance Component }
ComponentInfo holds the function to lazy initialize the component and the instance created following the singleton pattern
func (*ComponentInfo) Get ¶
func (componentInfo *ComponentInfo) Get() Component
Get s the instance. If it is not created, creates and stores it to the next calls
type ComponentInitializerFunction ¶
type ComponentInitializerFunction func() Component
ComponentInitializerFunction specifies a function for lazily initializing a component