plugins

package
v1.2.18 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2020 License: Apache-2.0 Imports: 24 Imported by: 95

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v1.2.15

func Add(p Plugin)

func Execute added in v1.2.8

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

func ExecuteWithCustomMenu added in v1.2.15

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 added in v1.2.15

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 added in v1.2.15

func Exist(p Plugin) bool

func GetAll added in v1.2.15

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 added in v1.2.8

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

func (*Base) ExecuteTmpl added in v1.2.8

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

func (*Base) ExecuteTmplWithCustomMenu added in v1.2.15

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

func (*Base) ExecuteTmplWithMenu added in v1.2.15

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

func (*Base) ExecuteTmplWithMenuAndNavButtons added in v1.2.15

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

func (*Base) ExecuteTmplWithNavButtons added in v1.2.15

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

func (*Base) GetGenerators added in v1.2.15

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

func (*Base) GetHandler added in v1.2.8

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

func (*Base) GetIndexURL added in v1.2.15

func (b *Base) GetIndexURL() string

func (*Base) GetInfo added in v1.2.15

func (b *Base) GetInfo() Info

func (*Base) GetSettingPage added in v1.2.15

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

func (*Base) HTML added in v1.2.8

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

func (*Base) HTMLBtns added in v1.2.15

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

func (*Base) HTMLCustomMenu added in v1.2.15

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

func (*Base) HTMLFile added in v1.2.8

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

func (*Base) HTMLFiles added in v1.2.8

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

func (*Base) HTMLMenu added in v1.2.15

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

func (*Base) HTMLMenuWithBtns added in v1.2.15

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

func (*Base) InitBase added in v1.2.8

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

func (*Base) InitPlugin added in v1.2.15

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

func (*Base) IsInstalled added in v1.2.15

func (b *Base) IsInstalled() bool

func (*Base) Name added in v1.2.8

func (b *Base) Name() string

func (*Base) NewMenu added in v1.2.15

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

func (*Base) Prefix added in v1.2.8

func (b *Base) Prefix() string

func (*Base) SetInfo added in v1.2.15

func (b *Base) SetInfo(info Info)

func (*Base) Title added in v1.2.15

func (b *Base) Title() string

func (*Base) Uninstall added in v1.2.15

func (b *Base) Uninstall() error

func (*Base) Upgrade added in v1.2.15

func (b *Base) Upgrade() error

type BasePlugin added in v1.2.15

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

func (*BasePlugin) GetIndexURL added in v1.2.15

func (b *BasePlugin) GetIndexURL() string

func (*BasePlugin) GetInfo added in v1.2.15

func (b *BasePlugin) GetInfo() Info

func (*BasePlugin) IsInstalled added in v1.2.15

func (b *BasePlugin) IsInstalled() bool

func (*BasePlugin) Name added in v1.2.15

func (b *BasePlugin) Name() string

type GetOnlineRes added in v1.2.15

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

type GetOnlineResData added in v1.2.15

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

type Info added in v1.2.15

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 added in v1.2.15

func (i Info) IsFree() bool

type Page added in v1.2.15

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 added in v1.2.15

func FindByName(name string) (Plugin, bool)

func FindByNameAll added in v1.2.16

func FindByNameAll(name string) (Plugin, bool)

func LoadFromPlugin added in v1.0.0

func LoadFromPlugin(mod string) Plugin

func NewBasePluginWithInfo added in v1.2.15

func NewBasePluginWithInfo(info Info) Plugin

func NewBasePluginWithInfoAndIndexURL added in v1.2.15

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

type Plugins added in v1.2.15

type Plugins []Plugin

func Get added in v1.2.15

func Get() Plugins

func GetPluginsWithInfos added in v1.2.15

func GetPluginsWithInfos(info []Info) Plugins

func (Plugins) Add added in v1.2.15

func (pp Plugins) Add(p Plugin) Plugins

func (Plugins) Exist added in v1.2.15

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