plugins

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(p Plugin)

func Execute

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

func ExecuteWithCustomMenu

func ExecuteWithCustomMenu(ctx *context.Context,
	navButtons types.Buttons,
	user models.UserModel,
	panel types.Panel,
	menu *menu.Menu, logo string, options template.ExecuteOptions) *bytes.Buffer

func ExecuteWithMenu

func ExecuteWithMenu(ctx *context.Context,
	conn db.Connection,
	navButtons types.Buttons,
	user models.UserModel,
	panel types.Panel,
	name, logo string, options template.ExecuteOptions) *bytes.Buffer

func Exist

func Exist(p Plugin) bool

func GetAll

func GetAll(req remote_server.GetOnlineReq, token string) (Plugins, Page)

func GetHandler

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

GetHandler is a help method for Plugin GetHandler.

Types

type Base

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

func (*Base) ExecuteTmpl

func (b *Base) ExecuteTmpl(ctx *context.Context, panel types.Panel, options template.ExecuteOptions) *bytes.Buffer

func (*Base) ExecuteTmplWithCustomMenu

func (b *Base) ExecuteTmplWithCustomMenu(ctx *context.Context, panel types.Panel, menu *menu.Menu, options template.ExecuteOptions) *bytes.Buffer

func (*Base) ExecuteTmplWithMenu

func (b *Base) ExecuteTmplWithMenu(ctx *context.Context, panel types.Panel, options template.ExecuteOptions) *bytes.Buffer

func (*Base) ExecuteTmplWithMenuAndNavButtons

func (b *Base) ExecuteTmplWithMenuAndNavButtons(ctx *context.Context, panel types.Panel, menu *menu.Menu,
	btns types.Buttons, options template.ExecuteOptions) *bytes.Buffer

func (*Base) ExecuteTmplWithNavButtons

func (b *Base) ExecuteTmplWithNavButtons(ctx *context.Context, panel types.Panel, btns types.Buttons,
	options template.ExecuteOptions) *bytes.Buffer

func (*Base) GetGenerators

func (b *Base) GetGenerators() table.GeneratorList

func (*Base) GetHandler

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

func (*Base) GetIndexURL

func (b *Base) GetIndexURL() string

func (*Base) GetInfo

func (b *Base) GetInfo() Info

func (*Base) GetSettingPage

func (b *Base) GetSettingPage() table.Generator

func (*Base) HTML

func (b *Base) HTML(ctx *context.Context, panel types.Panel, options ...template.ExecuteOptions)

func (*Base) HTMLBtns

func (b *Base) HTMLBtns(ctx *context.Context, panel types.Panel, btns types.Buttons, options ...template.ExecuteOptions)

func (*Base) HTMLCustomMenu

func (b *Base) HTMLCustomMenu(ctx *context.Context, panel types.Panel, menu *menu.Menu, options ...template.ExecuteOptions)

func (*Base) HTMLFile

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

func (*Base) HTMLFiles

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

func (*Base) HTMLMenu

func (b *Base) HTMLMenu(ctx *context.Context, panel types.Panel, options ...template.ExecuteOptions)

func (*Base) HTMLMenuWithBtns

func (b *Base) HTMLMenuWithBtns(ctx *context.Context, panel types.Panel, menu *menu.Menu, btns types.Buttons, options ...template.ExecuteOptions)

func (*Base) InitBase

func (b *Base) InitBase(srv service.List, prefix string)

func (*Base) InitPlugin

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

func (*Base) IsInstalled

func (b *Base) IsInstalled() bool

func (*Base) Name

func (b *Base) Name() string

func (*Base) NewMenu

func (b *Base) NewMenu(data menu.NewMenuData) (int64, error)

func (*Base) Prefix

func (b *Base) Prefix() string

func (*Base) SetInfo

func (b *Base) SetInfo(info Info)

func (*Base) Title

func (b *Base) Title() string

func (*Base) Uninstall

func (b *Base) Uninstall() error

func (*Base) Upgrade

func (b *Base) Upgrade() error

type BasePlugin

type BasePlugin struct {
	Base
	Info      Info
	IndexURL  string
	Installed bool
}

func (*BasePlugin) GetIndexURL

func (b *BasePlugin) GetIndexURL() string

func (*BasePlugin) GetInfo

func (b *BasePlugin) GetInfo() Info

func (*BasePlugin) IsInstalled

func (b *BasePlugin) IsInstalled() bool

func (*BasePlugin) Name

func (b *BasePlugin) Name() string

type GetOnlineRes

type GetOnlineRes struct {
	Code int              `json:"code"`
	Msg  string           `json:"msg"`
	Data GetOnlineResData `json:"data"`
}

type GetOnlineResData

type GetOnlineResData struct {
	List    []Info `json:"list"`
	Count   int    `json:"count"`
	HasMore bool   `json:"has_more"`
	Page    Page   `json:"page"`
}

type Info

type Info struct {
	Title            string    `json:"title" yaml:"title" ini:"title"`
	Description      string    `json:"description" yaml:"description" ini:"description"`
	OldVersion       string    `json:"old_version" yaml:"old_version" ini:"old_version"`
	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"`
	MiniCover        string    `json:"mini_cover" yaml:"mini_cover" ini:"mini_cover"`
	Website          string    `json:"website" yaml:"website" ini:"website"`
	Agreement        string    `json:"agreement" yaml:"agreement" ini:"agreement"`
	CreateDate       time.Time `json:"create_date" yaml:"create_date" ini:"create_date"`
	UpdateDate       time.Time `json:"update_date" yaml:"update_date" ini:"update_date"`
	ModulePath       string    `json:"module_path" yaml:"module_path" ini:"module_path"`
	Name             string    `json:"name" yaml:"name" ini:"name"`
	Uuid             string    `json:"uuid" yaml:"uuid" ini:"uuid"`
	Downloaded       bool      `json:"downloaded" yaml:"downloaded" ini:"downloaded"`
	ExtraDownloadUrl string    `json:"extra_download_url" yaml:"extra_download_url" ini:"extra_download_url"`
	Price            []string  `json:"price" yaml:"price" ini:"price"`
	GoodUUIDs        []string  `json:"good_uuids" yaml:"good_uuids" ini:"good_uuids"`
	GoodNum          int64     `json:"good_num" yaml:"good_num" ini:"good_num"`
	CommentNum       int64     `json:"comment_num" yaml:"comment_num" ini:"comment_num"`
	Order            int64     `json:"order" yaml:"order" ini:"order"`
	Features         string    `json:"features" yaml:"features" ini:"features"`
	Questions        []string  `json:"questions" yaml:"questions" ini:"questions"`
	HasBought        bool      `json:"has_bought" yaml:"has_bought" ini:"has_bought"`
	CanUpdate        bool      `json:"can_update" yaml:"can_update" ini:"can_update"`
	Legal            bool      `json:"legal" yaml:"legal" ini:"legal"`
	SkipInstallation bool      `json:"skip_installation" yaml:"skip_installation" ini:"skip_installation"`
}

func (Info) IsFree

func (i Info) IsFree() bool

type Page

type Page struct {
	CSS  string `json:"css"`
	HTML string `json:"html"`
	JS   string `json:"js"`
}

type Plugin

type Plugin interface {
	GetHandler() context.HandlerMap
	InitPlugin(services service.List)
	GetGenerators() table.GeneratorList
	Name() string
	Prefix() string
	GetInfo() Info
	GetIndexURL() string
	GetSettingPage() table.Generator
	IsInstalled() bool
	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

func FindByName(name string) (Plugin, bool)

func FindByNameAll

func FindByNameAll(name string) (Plugin, bool)

func LoadFromPlugin

func LoadFromPlugin(mod string) Plugin

func NewBasePluginWithInfo

func NewBasePluginWithInfo(info Info) Plugin

func NewBasePluginWithInfoAndIndexURL

func NewBasePluginWithInfoAndIndexURL(info Info, u string, installed bool) Plugin

type Plugins

type Plugins []Plugin

func Get

func Get() Plugins

func GetPluginsWithInfos

func GetPluginsWithInfos(info []Info) Plugins

func (Plugins) Add

func (pp Plugins) Add(p Plugin) Plugins

func (Plugins) Exist

func (pp Plugins) Exist(p Plugin) bool

Jump to

Keyboard shortcuts

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