Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoType is returned when no type is specified ErrNoType = errors.New("plugin: no type") // ErrNoPluginID is returned when no id is specified ErrNoPluginID = errors.New("plugin: no id") )
Functions ¶
Types ¶
type InitContext ¶
InitContext is used for plugin inititalization
func NewContext ¶
func NewContext(r *Registration, path string) *InitContext
type Registration ¶
type Registration struct { // Type of the plugin Type Type // ID of the plugin ID string // Config specific to the plugin Config interface{} // InitFn is called when initializing a plugin. InitFn func(*InitContext) (interface{}, error) }
Registration contains information for registering a plugin
func ForType ¶
func ForType(t Type) []*Registration
func Get ¶
func Get(t Type, id string) *Registration
func (*Registration) Init ¶
func (r *Registration) Init(ic *InitContext) (interface{}, error)
Init the registered plugin
Click to show internal directories.
Click to hide internal directories.