baseplugin

package module
v0.0.0-...-5e9ece7 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: MIT Imports: 22 Imported by: 1

README

baseplugin

Package baseplugin provides base functional for creating new plugins.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStruct             = errors.New("passed param isn't sruct type")
	ErrStructField           = errors.New("sruct doesn't have AppPlugin interface field")
	ErrTmpDirPrefixUndefined = errors.New("tmpdir prefix is undefined")
)
View Source
var ErrContainerUndefined = errors.New("zip container is undefined")
View Source
var PluginConfig = Configuration{}

Functions

func RegisterRPCPluginServ

func RegisterRPCPluginServ(p AppPlugin) error

func RunPlugin

func RunPlugin(plugin interface{}, params *Params) error

Types

type AppPlugin

type AppPlugin interface {
	Init(common.HttpPlugin) error
	Destroy()
	IndexHandle(w http.ResponseWriter, r *http.Request, rp httprouter.Params)
	GetPluginAppCache(r *http.Request) string
	GetPluginJS(r *http.Request, es6 bool) string
	GetPluginDictJS(r *http.Request) string
	GetPluginUserSettingsJS(r *http.Request, es6 bool) string
	GetRenderData(r *http.Request, renderParams map[string]interface{})

	TempDir() string
	Logger() *log.Logger
	FileSystem() fsIntf.FileSystem
	FileServer(key ...string) http.Handler
	App() appIntf.App
	AppServ() appIntf.AppServ

	TranslationDict(langSequence string) string
	FileContent(fileName string, r *http.Request, renderParams ...map[string]interface{}) ([]byte, error)
	FileContentHandler() http.Handler
	Get(url string) (*http.Response, error)

	CurrentUserId(r *http.Request) entity.EntityId
	// contains filtered or unexported methods
}

AppPlugin is an interface to be implemented by every plugin

func NewAppPlugin

func NewAppPlugin(params *Params) (AppPlugin, error)

NewAppPlugin creates AppPlugin

type Configuration

type Configuration struct {
	RPCAddr              string
	LogDisableTimestamps bool
}

func (*Configuration) Init

func (c *Configuration) Init()

type Params

type Params struct {
	FullName         string
	Name             string
	TranslationsRoot string
	ZipContainer     *common.ZipContainer
	CreateTempDir    bool
	// contains filtered or unexported fields
}

type RPCPluginServ

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

func (*RPCPluginServ) GetTextResource

func (srv *RPCPluginServ) GetTextResource(p *pluginIntf.GetTextResourceParams, s *string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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