pluginmanager

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PluginConfFile

type PluginConfFile struct {
	Rules map[string]PluginRule
}

type PluginManager

type PluginManager struct {
	Rules     map[string]*PluginRule
	Reader    Reader
	ApiType   string
	IsDevMode bool
}

Builtin will packaged as zip Installed on runtime

func New

func New(fr Reader, apiType string, isDevMode bool) *PluginManager

func (*PluginManager) LoadBuiltinPlugin

func (p *PluginManager) LoadBuiltinPlugin() error

func (*PluginManager) LoadUserPlugins

func (p *PluginManager) LoadUserPlugins(userPlugins PluginConfFile) error

func (*PluginManager) OverrideRules

func (p *PluginManager) OverrideRules(userOverrides map[string]PluginUserOverride) error

func (*PluginManager) ReadPluginCode

func (p *PluginManager) ReadPluginCode(path string) (string, error)

type PluginRule

type PluginRule struct {
	File    string
	Disable bool
	Options map[string]any
}

these are the

type PluginUserOverride

type PluginUserOverride struct {
	Disable *bool          `json:"omitempty" yaml:"omitempty" toml:"omitempty"`
	Options map[string]any `json:"omitempty" yaml:"omitempty" toml:"omitempty"`
}

type Reader

type Reader interface {
	// data contains the container for which data will be loaded
	ReadFile(location string, data any) error
	ReadIntoRawBytes(location string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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