Documentation
¶
Index ¶
- Constants
- func GetPluginTypes() []string
- func NewArgErr(key string) error
- func RegInitFunc(pluginType string, initFunc NewPluginFunc)
- func RegPlugin(c *Config) (err error)
- func Walk(ctx context.Context, qCtx *Context, entryTag string) (err error)
- type ArgError
- type Args
- func (a Args) Load(key string) (value interface{}, ok bool)
- func (a Args) LoadBool(key string) (ok bool)
- func (a Args) LoadInt(key string) (value int, ok bool)
- func (a Args) LoadSlice(key string) (s []interface{}, ok bool)
- func (a Args) LoadString(key string) (value string, ok bool)
- func (a Args) WeakDecode(output interface{}) error
- type Checker
- type Config
- type Context
- type NewPluginFunc
- type OneWayPlugin
- type Plugin
- type TagNotDefinedErr
- type TypeNotDefinedErr
Constants ¶
View Source
const IterationLimit = 50
IterationLimit is to prevent endless loops.
Variables ¶
This section is empty.
Functions ¶
func GetPluginTypes ¶
func GetPluginTypes() []string
GetPluginTypes returns all registered plugin types.
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 NewPluginFunc ¶
type OneWayPlugin ¶
OneWayPlugin only modifies qCtx
type Plugin ¶
type Plugin interface { Tag() string Type() string // Do modifies qCtx and returns next plugin tag. Do(ctx context.Context, qCtx *Context) (next string, err error) }
func NewRedirectPlugin ¶
NewRedirectPlugin returns a redirectPlugin. redirectPlugin is a plugin that can redirect qCtx to other plugin under certain condition. It should not modify qCtx. If checker.Match() returns true, the plugin tag from `next` will be returned in redirectPlugin.Do(). Otherwise, `redirect`.
func WrapOneWayPlugin ¶
func WrapOneWayPlugin(config *Config, doPlugin OneWayPlugin, next string) Plugin
WrapOneWayPlugin returns a oneWayPluginWrapper which implements Plugin.
type TagNotDefinedErr ¶
type TagNotDefinedErr struct {
// contains filtered or unexported fields
}
func NewTagNotDefinedErr ¶
func NewTagNotDefinedErr(tag string) *TagNotDefinedErr
func (*TagNotDefinedErr) Error ¶
func (t *TagNotDefinedErr) Error() string
type TypeNotDefinedErr ¶
type TypeNotDefinedErr struct {
// contains filtered or unexported fields
}
func NewTypeNotDefinedErr ¶
func NewTypeNotDefinedErr(typ string) *TypeNotDefinedErr
func (*TypeNotDefinedErr) Error ¶
func (t *TypeNotDefinedErr) Error() string
Click to show internal directories.
Click to hide internal directories.