plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package plugin enables plugins to register with Abot and connect to the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingPluginName is returned when a plugin name is expected, but
	// but a blank name is provided.
	ErrMissingPluginName = errors.New("missing plugin name")

	// ErrMissingTrigger is returned when a trigger is expected but none
	// were found.
	ErrMissingTrigger = errors.New("missing plugin trigger")
)

Functions

func ConnectDB

func ConnectDB() (*sqlx.DB, error)

ConnectDB opens a connection to the database.

Types

type Config

type Config struct {
	Name          string
	Route         string
	CoreRPCAddr   string
	PluginRPCAddr string
}

Config holds options for a plugin.

type Plugin

type Plugin struct {
	Config  Config
	Vocab   *dt.Vocab
	Trigger *nlp.StructuredInput
}

Plugin holds config options for any Abot plugin. Name must be globally unique. Port takes the format of ":1234". Note that the colon is significant. ServerAddress will default to localhost if left blank.

func New

func New(name, coreRPCAddr string, trigger *nlp.StructuredInput) (*Plugin,
	error)

New builds a Plugin with its trigger, RPC, and name configured.

func (*Plugin) Register

func (p *Plugin) Register(pluginT interface{}) error

Register with Abot to begin communicating over RPC.

type Wrapper

type Wrapper struct {
	P         *Plugin
	RPCClient *rpc.Client
}

Wrapper wraps a plugin with an open connection to an RPC client.

Jump to

Keyboard shortcuts

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