go-admin: github.com/GoAdminGroup/go-admin/plugins Index | Files | Directories

package plugins

import "github.com/GoAdminGroup/go-admin/plugins"


Package Files


func Add Uses

func Add(p Plugin)

func Execute Uses

func Execute(ctx *context.Context, conn db.Connection, navButtons types.Buttons, user models.UserModel,
    panel types.Panel, animation ...bool) *bytes.Buffer

func Exist Uses

func Exist(p Plugin) bool

func GetHandler Uses

func GetHandler(app *context.App) context.HandlerMap

GetHandler is a help method for Plugin GetHandler.

type Base Uses

type Base struct {
    App       *context.App
    Services  service.List
    Conn      db.Connection
    UI        *ui.Service
    PlugName  string
    URLPrefix string

func (*Base) CheckUpdate Uses

func (b *Base) CheckUpdate() (update bool, version string)

func (*Base) ExecuteTmpl Uses

func (b *Base) ExecuteTmpl(ctx *context.Context, panel types.Panel, animation ...bool) *bytes.Buffer

func (*Base) GetHandler Uses

func (b *Base) GetHandler() context.HandlerMap

func (*Base) GetInfo Uses

func (b *Base) GetInfo() Info

func (*Base) GetInstallationPage Uses

func (b *Base) GetInstallationPage() (skip bool, gen table.Generator)

func (*Base) HTML Uses

func (b *Base) HTML(ctx *context.Context, panel types.Panel, animation ...bool)

func (*Base) HTMLFile Uses

func (b *Base) HTMLFile(ctx *context.Context, path string, data map[string]interface{}, animation ...bool)

func (*Base) HTMLFiles Uses

func (b *Base) HTMLFiles(ctx *context.Context, data map[string]interface{}, files []string, animation ...bool)

func (*Base) InitBase Uses

func (b *Base) InitBase(srv service.List)

func (*Base) InitPlugin Uses

func (b *Base) InitPlugin(services service.List)

func (*Base) IsInstalled Uses

func (b *Base) IsInstalled() bool

func (*Base) Name Uses

func (b *Base) Name() string

func (*Base) Prefix Uses

func (b *Base) Prefix() string

func (*Base) Translate Uses

func (b *Base) Translate(word string) string

func (*Base) Uninstall Uses

func (b *Base) Uninstall() error

func (*Base) Upgrade Uses

func (b *Base) Upgrade() error

type BasePlugin Uses

type BasePlugin struct {
    Info Info

func (*BasePlugin) GetInfo Uses

func (b *BasePlugin) GetInfo() Info

func (*BasePlugin) Name Uses

func (b *BasePlugin) Name() string

type Info Uses

type Info struct {
    Title       string    `json:"title" yaml:"title" ini:"title"`
    Description string    `json:"description" yaml:"description" ini:"description"`
    Version     string    `json:"version" yaml:"version" ini:"version"`
    Author      string    `json:"author" yaml:"author" ini:"author"`
    Banners     []string  `json:"banners" yaml:"banners" ini:"banners"`
    Url         string    `json:"url" yaml:"url" ini:"url"`
    Cover       string    `json:"cover" yaml:"cover" ini:"cover"`
    Website     string    `json:"website" yaml:"website" ini:"website"`
    Agreement   string    `json:"agreement" yaml:"agreement" ini:"agreement"`
    CreatedAt   time.Time `json:"created_at" yaml:"created_at" ini:"created_at"`
    UpdatedAt   time.Time `json:"updated_at" yaml:"updated_at" ini:"updated_at"`
    ModulePath  string    `json:"module_path" yaml:"module_path" ini:"module_path"`
    Name        string    `json:"name" yaml:"name" ini:"name"`
    Downloaded  bool      `json:"downloaded" yaml:"downloaded" ini:"downloaded"`
    Price       uint      `json:"price" yaml:"price" ini:"price"`

type Plugin Uses

type Plugin interface {
    GetHandler() context.HandlerMap
    InitPlugin(services service.List)
    Name() string
    Prefix() string
    GetInfo() Info
    GetInstallationPage() (skip bool, gen table.Generator)
    IsInstalled() bool
    CheckUpdate() (update bool, version string)
    Translate(word string) string
    Uninstall() error
    Upgrade() error

Plugin as one of the key components of goAdmin has three methods. GetRequest return all the path registered in the plugin. GetHandler according the url and method return the corresponding handler. InitPlugin init the plugin which do something like init the database and set the config and register the routes. The Plugin must implement the three methods.

func FindByName Uses

func FindByName(name string) (Plugin, bool)

func LoadFromPlugin Uses

func LoadFromPlugin(mod string) Plugin

func NewBasePluginWithInfo Uses

func NewBasePluginWithInfo(info Info) Plugin

type Plugins Uses

type Plugins []Plugin

func Get Uses

func Get() Plugins

func GetAll Uses

func GetAll() Plugins

func GetOnline Uses

func GetOnline() Plugins

func GetPluginsWithInfos Uses

func GetPluginsWithInfos(info []Info) Plugins

func (Plugins) Add Uses

func (pp Plugins) Add(p Plugin) Plugins

func (Plugins) Exist Uses

func (pp Plugins) Exist(p Plugin) bool



Package plugins imports 21 packages (graph) and is imported by 27 packages. Updated 2020-07-03. Refresh now. Tools for package owners.