Documentation ¶
Index ¶
- Constants
- func GetPluginTypes() []string
- func InitAndRegPlugin(c *Config) (err error)
- func NewErrFromTemplate(t ErrTemplate, args ...interface{}) error
- func PurgePluginRegister()
- func RegInitFunc(pluginType string, initFunc NewPluginFunc)
- func RegPlugin(p Plugin) error
- func Walk(ctx context.Context, qCtx *Context, entryTag string) (err error)
- type Args
- type Config
- type Context
- type DummyFunctional
- type DummyMatcher
- type DummyRouterPlugin
- type ErrTemplate
- type Error
- type Functional
- type FunctionalPlugin
- type FunctionalPluginWrapper
- type Matcher
- type MatcherPlugin
- type MatcherPluginWrapper
- type NewPluginFunc
- type Plugin
- type RouterPlugin
Constants ¶
View Source
const ( ETInvalidArgs = "invalid args: %w" ETPluginErr = "plugin %s reported an err: %w" ETTypeNotDefined = "plugin type %s not not defined" ETTagNotDefined = "plugin tag %s not not defined" )
View Source
const ( // IterationLimit is to prevent endless loops. IterationLimit = 50 // StopSignTag: See Walk(). StopSignTag = "end" )
Variables ¶
This section is empty.
Functions ¶
func GetPluginTypes ¶
func GetPluginTypes() []string
GetPluginTypes returns all registered plugin types.
func InitAndRegPlugin ¶ added in v0.10.0
InitAndRegPlugin inits and registers this plugin globally. Duplicate plugin tags are not allowed.
func NewErrFromTemplate ¶ added in v0.12.0
func NewErrFromTemplate(t ErrTemplate, args ...interface{}) error
func PurgePluginRegister ¶ added in v0.12.0
func PurgePluginRegister()
PurgePluginRegister should only be used in test.
func RegInitFunc ¶
func RegInitFunc(pluginType string, initFunc NewPluginFunc)
RegInitFunc registers this plugin type. This should only be called in init() of the plugin package. Duplicate plugin types are not allowed.
Types ¶
type Args ¶
type Args map[string]interface{}
Args contains plugin arguments.
func (Args) WeakDecode ¶
type DummyFunctional ¶ added in v0.10.0
type DummyFunctional struct {
WantErr error
}
type DummyMatcher ¶ added in v0.10.0
type DummyRouterPlugin ¶ added in v0.12.0
func (*DummyRouterPlugin) Tag ¶ added in v0.12.0
func (d *DummyRouterPlugin) Tag() string
func (*DummyRouterPlugin) Type ¶ added in v0.12.0
func (d *DummyRouterPlugin) Type() string
type ErrTemplate ¶ added in v0.12.0
type ErrTemplate string
type Functional ¶ added in v0.10.0
type FunctionalPlugin ¶ added in v0.10.0
type FunctionalPlugin interface { Plugin Functional }
func GetFunctionalPlugin ¶ added in v0.10.0
func GetFunctionalPlugin(tag string) (p FunctionalPlugin, ok bool)
type FunctionalPluginWrapper ¶ added in v0.10.0
type FunctionalPluginWrapper struct { Functional // contains filtered or unexported fields }
func WrapFunctionalPlugin ¶ added in v0.10.0
func WrapFunctionalPlugin(tag, typ string, functional Functional) *FunctionalPluginWrapper
WrapFunctionalPlugin returns a *FunctionalPluginWrapper which implements Plugin and FunctionalPlugin.
func (*FunctionalPluginWrapper) Tag ¶ added in v0.10.0
func (p *FunctionalPluginWrapper) Tag() string
func (*FunctionalPluginWrapper) Type ¶ added in v0.10.0
func (p *FunctionalPluginWrapper) Type() string
type MatcherPlugin ¶ added in v0.10.0
func GetMatcherPlugin ¶ added in v0.10.0
func GetMatcherPlugin(tag string) (p MatcherPlugin, ok bool)
type MatcherPluginWrapper ¶ added in v0.10.0
type MatcherPluginWrapper struct { Matcher // contains filtered or unexported fields }
func WrapMatcherPlugin ¶ added in v0.10.0
func WrapMatcherPlugin(tag, typ string, matcher Matcher) *MatcherPluginWrapper
WrapMatcherPlugin returns a *MatcherPluginWrapper which implements Plugin and MatcherPlugin.
func (*MatcherPluginWrapper) Tag ¶ added in v0.10.0
func (c *MatcherPluginWrapper) Tag() string
func (*MatcherPluginWrapper) Type ¶ added in v0.10.0
func (c *MatcherPluginWrapper) Type() string
type RouterPlugin ¶ added in v0.10.0
type RouterPlugin interface { Plugin Do(ctx context.Context, qCtx *Context) (next string, err error) }
func GetRouterPlugin ¶ added in v0.10.0
func GetRouterPlugin(tag string) (p RouterPlugin, ok bool)
Click to show internal directories.
Click to hide internal directories.