plugin

package
v2.9.9 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plugin provides the ability to load plugins

Package plugin provides the ability to load plugins

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default plugin loader
	DefaultPlugin = NewPlugin()
)

Functions

func Build

func Build(path string, c *Config) error

func Init

func Init(c *Config) error

Types

type Config

type Config struct {
	// Name of the plugin e.g rabbitmq
	Name string
	// Type of the plugin e.g broker
	Type string
	// Path specifies the import path
	Path string
	// NewFunc creates an instance of the plugin
	NewFunc interface{}
}

Config is the plugin config

func Load

func Load(path string) (*Config, error)

type Plugin

type Plugin interface {
	// Initialise a plugin with the config
	Init(c *Config) error
	// Load loads a .so plugin at the given path
	Load(path string) (*Config, error)
	// Build a .so plugin with config at the path specified
	Build(path string, c *Config) error
}

Plugin is a plugin loaded from a file

func NewPlugin

func NewPlugin() Plugin

NewPlugin creates a new plugin interface

Jump to

Keyboard shortcuts

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