Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRegistered ¶
func IsRegistered(plugin Plugin, opts ...PluginOption) bool
IsRegistered check plugin whether registered global. Notice plugin is not check whether is nil
func Register ¶
func Register(plugin Plugin, opts ...PluginOption) error
Register registers a global plugins
Types ¶
type Handler ¶
Handler is the plugin middleware handler which wraps an existing http.Handler passed in. Its the responsibility of the Handler to call the next http.Handler in the chain.
type Manager ¶
type Manager interface { Plugins(...PluginOption) []Plugin Register(Plugin, ...PluginOption) error }
Manager is the plugin manager which stores plugins and allows them to be retrieved. This is used by all the components of micro.
type Option ¶
type Option func(o *Options)
func WithCommand ¶
func WithCommand(cmd ...*cli.Command) Option
WithCommand adds commands to a plugin
type Options ¶
type Options struct { Name string Flags []cli.Flag Commands []*cli.Command Handlers []Handler Init func(*cli.Context) error }
Options are used as part of a new plugin
type Plugin ¶
type Plugin interface { // Global Flags Flags() []cli.Flag // Sub-commands Commands() []*cli.Command // Handle is the middleware handler for HTTP requests. We pass in // the existing handler so it can be wrapped to create a call chain. Handler() Handler // Init called when command line args are parsed. // The initialised cli.Context is passed in. Init(*cli.Context) error // Name of the plugin String() string }
Plugin is the interface for plugins to micro. It differs from go-micro in that it's for the micro API, Web, Sidecar, CLI. It's a method of building middleware for the HTTP side.
type PluginOption ¶
type PluginOption func(o *PluginOptions)
func Module ¶
func Module(m string) PluginOption
Module will scope the plugin to a specific module, e.g. the "api"
type PluginOptions ¶
type PluginOptions struct {
Module string
}
Directories ¶
Path | Synopsis |
---|---|
Package etcd provides an etcd service registry
|
Package etcd provides an etcd service registry |
nats
|
|
broker
Package nats provides a NATS broker
|
Package nats provides a NATS broker |
Package postgres implements the postgres store
|
Package postgres implements the postgres store |
pgx
Package pgx implements the postgres store with pgx driver
|
Package pgx implements the postgres store with pgx driver |
redis
|
|
tailscale
|
|