Documentation ¶
Index ¶
- func ListPluginsStr() string
- func LoadESPlugin(router *mux.Router, p ESPlugin, mw []middleware.Middleware) error
- func LoadPlugin(router *mux.Router, p Plugin) error
- func LoadRSPlugin(router *mux.Router, p RSPlugin, mw []middleware.Middleware) error
- func RegisterPlugin(p Plugin)
- type ESPlugin
- type Plugin
- type PluginBy
- type RSPlugin
- type Route
- type RouteBy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListPluginsStr ¶
func ListPluginsStr() string
ListPluginsStr returns a string listing the registered plugins.
func LoadESPlugin ¶
func LoadESPlugin(router *mux.Router, p ESPlugin, mw []middleware.Middleware) error
func LoadPlugin ¶
LoadPlugin is currently responsible for two things: firstly, it executes the plugin's initFunc to ensure it makes all the initializations before the plugin is functional and second, calling loadRoutes
func LoadRSPlugin ¶
func LoadRSPlugin(router *mux.Router, p RSPlugin, mw []middleware.Middleware) error
func RegisterPlugin ¶
func RegisterPlugin(p Plugin)
RegisterPlugin plugs in plugin. All plugins must have a name: preferably lowercase and one word. The name of the plugin must be unique. A plugin, however, may not define any routes, but still be useful, like a middleware.
Types ¶
type ESPlugin ¶
type ESPlugin interface { // mw takes a array of middleware to be intialized by ES Plugin InitFunc(mw []middleware.Middleware) error // contains filtered or unexported methods }
ElasticSearchPlugin holds the plugin for ES
type Plugin ¶
type Plugin interface { // InitFunc returns the plugin's setup function that is executed // before the plugin routes are loaded in the router. InitFunc() error // The plugin's elastic search middleware, if any. ESMiddleware() []middleware.Middleware // The plugin's reactive search middleware, if any. RSMiddleware() []middleware.Middleware // contains filtered or unexported methods }
Plugin is a type that holds information about the plugin.
func ListPlugins ¶
func ListPlugins() []Plugin
ListPlugins returns the list of plugins that are currently registered.
type PluginBy ¶
By is the type of a "less" function that defines the ordering of Plugins.
func (PluginBy) PluginSort ¶
Sort is a method on the function type, By, that sorts the argument slice according to the function.
type RSPlugin ¶
type RSPlugin interface { // mw takes a array of middleware to be intialized by ES Plugin InitFunc(mw []middleware.Middleware) error // contains filtered or unexported methods }
ReactiveSearchPlugin holds the plugin for ReactiveSearch API
type Route ¶
type Route struct { // Name is the name of the route. In order to avoid conflicts in // the router, the name preferably should be a combination of both // http method type and the path. For example: "Get foobar" would // be an appropriate name for [GET foobar] endpoint. Name string // Methods represents an array of HTTP method type. It is preferable // to use values defined in net/http package to avoid typos. Methods []string // Path is the path that it expects to serve the requests on. // If the path contains any variables, then they must be declared // in accordance to the format define by the router to which // these routes are registered which in our case is: gorilla/mux. Path string // PathPrefix serves as a matcher for the URL path prefix. // This matches if the given template is a prefix of the full // URL path. See Route.Path() for details on the tpl argument. // Note that it does not treat slashes specially ("/foobar/" // will be matched by the prefix "/foo") so you may want to // use a trailing slash here. PathPrefix string // HandlerFunc is the handler function that is responsible for // responding the request made to this route. HandlerFunc http.HandlerFunc // Description about this route. Description string }
Route is a type that contains information about a route.