plugin

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "plugin"

Variables

This section is empty.

Functions

func All

func All() map[string][]Plugin

func Register

func Register(pg Plugin, opts ...Opt)

Types

type Base

type Base struct {
	Name         string
	OnMiddleware func() types.Middleware
	OnInit       func(ent entry.Entry)
	OnCommands   func(cmd *cobra.Command)
	OnFlags      func(flags *pflag.FlagSet)
	OnWatch      func(name string, resp *types.WatchResp)
	OnVars       func(w func(name string, data func() interface{}))
	OnCodec      func(name string, resp *types.WatchResp) (map[string]interface{}, error)
}

func (*Base) Commands

func (p *Base) Commands() *cobra.Command

func (*Base) Flags

func (p *Base) Flags() *pflag.FlagSet

func (*Base) Init

func (p *Base) Init(ent entry.Entry) (err error)

func (*Base) String

func (p *Base) String() string

func (*Base) Watch

func (p *Base) Watch(name string, r *types.WatchResp) (err error)

type Opt added in v0.0.21

type Opt func(o *options)

func Module

func Module(m string) Opt

Module will scope the plugin to a specific module, e.g. the "api"

type Plugin

type Plugin interface {
	String() string
	Flags() *pflag.FlagSet
	Commands() *cobra.Command
	Init(ent entry.Entry) error
	Watch(name string, r *types.WatchResp) error
}

func List

func List(opts ...Opt) []Plugin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL