Documentation
¶
Overview ¶
Package plugins provides support for Yaegi-style http.Handler "plugins", for use in JAR. Code should be self-contained. The standard library is available for imports, anything else needs GoPaths and whatnot defined, and isnt't greatly supported.
If the handler needs some configuration data, there is a `map[string]string` that may be used. If so, ensure you have a function called `SetConfig(map[string]string)` defined that will take the provided map and set it in your code. See `testHandlerConfigSrc` in the included _test file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerPlugin ¶
type HandlerPlugin struct {
Source string
FuncName string
Config map[string]string
Options InterpreterOptions
// contains filtered or unexported fields
}
HandlerPlugin is a stuct to handle the creation, validation, and inclusion of yaegi-loaded "plugins"
func NewHandlerPlugin ¶
func NewHandlerPlugin(src, funcName string) (*HandlerPlugin, error)
NewHandlerPlugin is a quick creator that also runs Bootrap, returning an error if Bootstrap did, otherwise returning a reference to the created HandlerPlugin.
func NewHandlerPluginWithConfig ¶
func NewHandlerPluginWithConfig(src, funcName string, config map[string]string) (*HandlerPlugin, error)
NewHandlerPluginWithConfig is a quick creator that also runs Bootrap, returning an error if Bootstrap did, otherwise returning a reference to the created HandlerPlugin.
func (*HandlerPlugin) Bootstrap ¶
func (h *HandlerPlugin) Bootstrap() (berr error)
Bootstrap is an initializer that *must* be called before Handler, and anytime the public attributes (Source, FuncName, Options) are changed.
func (*HandlerPlugin) CopyHandler ¶
func (h *HandlerPlugin) CopyHandler() func(http.Handler) http.Handler
CopyHandler returns the Handler function itself.
type InterpreterOptions ¶
InterpreterOptions is used to change how the interpreter runs. Aliased so including packages needn't import interp directly.