driver

package
v1.3.4-beta Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drivers

func Drivers(group ...string) []string

func LoadPlugins

func LoadPlugins(fs *embed.FS, dir string, target string) error

func Register

func Register(driver IDriver)

Types

type Define

type Define struct {
	// contains filtered or unexported fields
}

func NewDefine

func NewDefine(d *PluginDefine) *Define

func (*Define) Columns

func (d *Define) Columns() []string

func (*Define) Drivers

func (d *Define) Drivers() []*Field

func (*Define) Fields

func (d *Define) Fields(fields ...*Field) []*Field

func (*Define) Profession

func (d *Define) Profession() string

func (*Define) Render

func (d *Define) Render() map[string]interface{}

func (*Define) Skill

func (d *Define) Skill() string

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func (*Driver) Define

func (d *Driver) Define() IDefine

func (*Driver) Front

func (d *Driver) Front() string

func (*Driver) Group

func (d *Driver) Group() string

func (*Driver) ID

func (d *Driver) ID() string

func (*Driver) Name

func (d *Driver) Name() string

func (*Driver) Title

func (d *Driver) Title() string

type DynamicDrivers

type DynamicDrivers eosc.Untyped[string, IDriver]

type Field

type Field struct {
	Name  string   `yaml:"name"`
	Title string   `yaml:"title"`
	Attr  string   `json:"attr,omitempty"`
	Enum  []string `json:"enum,omitempty"`
}

type IDefine

type IDefine interface {
	Profession() string
	Skill() string
	Drivers() []*Field
	Fields(fields ...*Field) []*Field
	Render() map[string]interface{}
	Columns() []string
}

type IDriver

type IDriver interface {
	ID() string
	Name() string
	Title() string
	Group() string
	Front() string
	Define() IDefine
}

func Get

func Get(name string) (IDriver, bool)

func List

func List(group ...string) []IDriver

func NewDriver

func NewDriver(cfg *PluginCfg) IDriver

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) Drivers

func (m *Manager) Drivers() []string

func (*Manager) DriversByGroup

func (m *Manager) DriversByGroup(group string) []string

func (*Manager) Get

func (m *Manager) Get(name string) (IDriver, bool)

func (*Manager) List

func (m *Manager) List() []IDriver

func (*Manager) ListByGroup

func (m *Manager) ListByGroup(group string) []IDriver

func (*Manager) Register

func (m *Manager) Register(driver IDriver)

type PluginCfg

type PluginCfg struct {
	Id      string        `json:"id,omitempty" yaml:"id"`
	Name    string        `json:"name,omitempty" yaml:"name"`
	Cname   string        `json:"cname,omitempty" yaml:"cname"`
	Resume  string        `json:"resume,omitempty" yaml:"resume"`
	Version string        `json:"version,omitempty" yaml:"version"`
	ICon    string        `json:"icon,omitempty" yaml:"icon"`
	Driver  string        `json:"driver,omitempty" yaml:"driver"`
	GroupId string        `json:"group_id,omitempty" yaml:"group_id"`
	Front   string        `json:"front,omitempty" yaml:"front"`
	Define  *PluginDefine `json:"define,omitempty" yaml:"define"`
}

func Read

func Read(input []byte) (*PluginCfg, error)

type PluginDefine

type PluginDefine struct {
	Profession string            `yaml:"profession"`
	Drivers    []*Field          `yaml:"drivers"`
	Skill      string            `yaml:"skill"`
	Fields     []*Field          `yaml:"fields"`
	Render     map[string]string `yaml:"render"`
}

Jump to

Keyboard shortcuts

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