engine

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Content

func Content(ctx interface{}, panel types.GetPanelFn)

Content call the Content method of defaultAdapter. If defaultAdapter is nil, it will panic.

func Register

func Register(ada adapter.WebFrameWork)

Register set default adapter of engine.

func User

func User(ctx interface{}) (models.UserModel, bool)

User call the User method of defaultAdapter.

Types

type ConnectionSetter

type ConnectionSetter func(db.Connection)

type Engine

type Engine struct {
	PluginList plugins.Plugins
	Adapter    adapter.WebFrameWork
	Services   service.List
	NavButtons *types.Buttons
	// contains filtered or unexported fields
}

Engine is the core component of goAdmin. It has two attributes. PluginList is an array of plugin. Adapter is the adapter of web framework context and goAdmin context. The relationship of adapter and plugin is that the adapter use the plugin which contains routers and controller methods to inject into the framework entity and make it work.

func Default

func Default() *Engine

Default return the default engine instance.

func (*Engine) AddAdapter

func (eng *Engine) AddAdapter(ada adapter.WebFrameWork) *Engine

AddAdapter add the adapter of engine.

func (*Engine) AddAuthService

func (eng *Engine) AddAuthService(processor auth.Processor) *Engine

AddAuthService customize the auth logic with given callback function.

func (*Engine) AddConfig

func (eng *Engine) AddConfig(cfg *config.Config) *Engine

AddConfig set the global config.

func (*Engine) AddConfigFromINI

func (eng *Engine) AddConfigFromINI(path string) *Engine

AddConfigFromINI set the global config from ini file.

func (*Engine) AddConfigFromJSON

func (eng *Engine) AddConfigFromJSON(path string) *Engine

AddConfigFromJSON set the global config from json file.

func (*Engine) AddConfigFromYAML

func (eng *Engine) AddConfigFromYAML(path string) *Engine

AddConfigFromYAML set the global config from yaml file.

func (*Engine) AddDisplayFilterLimit

func (eng *Engine) AddDisplayFilterLimit(limit int) *Engine

AddDisplayFilterLimit call types.AddDisplayFilterLimit.

func (*Engine) AddDisplayFilterSubstr

func (eng *Engine) AddDisplayFilterSubstr(start int, end int) *Engine

AddDisplayFilterSubstr call types.AddDisplayFilterSubstr.

func (*Engine) AddDisplayFilterToLower

func (eng *Engine) AddDisplayFilterToLower() *Engine

AddDisplayFilterToLower call types.AddDisplayFilterToLower.

func (*Engine) AddDisplayFilterToTitle

func (eng *Engine) AddDisplayFilterToTitle() *Engine

AddDisplayFilterToTitle call types.AddDisplayFilterToTitle.

func (*Engine) AddDisplayFilterToUpper

func (eng *Engine) AddDisplayFilterToUpper() *Engine

AddDisplayFilterToUpper call types.AddDisplayFilterToUpper.

func (*Engine) AddDisplayFilterTrimSpace

func (eng *Engine) AddDisplayFilterTrimSpace() *Engine

AddDisplayFilterTrimSpace call types.AddDisplayFilterTrimSpace.

func (*Engine) AddDisplayFilterXssFilter

func (eng *Engine) AddDisplayFilterXssFilter() *Engine

AddDisplayFilterXssFilter call types.AddDisplayFilterXssFilter.

func (*Engine) AddDisplayFilterXssJsFilter

func (eng *Engine) AddDisplayFilterXssJsFilter() *Engine

AddDisplayFilterXssJsFilter call types.AddDisplayFilterXssJsFilter.

func (*Engine) AddGenerator

func (eng *Engine) AddGenerator(key string, g table.Generator) *Engine

AddGenerator add table model generator.

func (*Engine) AddGenerators

func (eng *Engine) AddGenerators(list ...table.GeneratorList) *Engine

AddGenerators add the admin generators.

func (*Engine) AddGlobalDisplayProcessFn

func (eng *Engine) AddGlobalDisplayProcessFn(f types.FieldFilterFn) *Engine

AddGlobalDisplayProcessFn call types.AddGlobalDisplayProcessFn.

func (*Engine) AddNavButtons

func (eng *Engine) AddNavButtons(title template2.HTML, icon string, action types.Action) *Engine

AddNavButtons add the nav buttons.

func (*Engine) AddNavButtonsRaw

func (eng *Engine) AddNavButtonsRaw(btns ...types.Button) *Engine

AddNavButtonsRaw add the nav buttons.

func (*Engine) AddPluginList

func (eng *Engine) AddPluginList(plugs plugins.Plugins) *Engine

AddPluginList add the plugins

func (*Engine) AddPlugins

func (eng *Engine) AddPlugins(plugs ...plugins.Plugin) *Engine

AddPlugins add the plugins

func (*Engine) AdminPlugin

func (eng *Engine) AdminPlugin() *admin.Admin

AdminPlugin get the admin plugin. if not exist, create one.

func (*Engine) Clone

func (eng *Engine) Clone(e *Engine) *Engine

Clone copy a new Engine.

func (*Engine) ClonedBySetter

func (eng *Engine) ClonedBySetter(setter Setter) *Engine

ClonedBySetter copy a new Engine by a setter callback function.

func (*Engine) Content

func (eng *Engine) Content(ctx interface{}, panel types.GetPanelFn)

Content call the Content method of engine adapter. If adapter is nil, it will panic.

func (*Engine) DB

func (eng *Engine) DB(driver string) db.Connection

DB return the db connection of given driver.

func (*Engine) Data

func (eng *Engine) Data(method, url string, handler context.Handler, noAuth ...bool)

Data inject the route and corresponding handler to the web framework.

func (*Engine) DefaultConnection

func (eng *Engine) DefaultConnection() db.Connection

DefaultConnection return the default db connection.

func (*Engine) FindPluginByName

func (eng *Engine) FindPluginByName(name string) (plugins.Plugin, bool)

FindPluginByName find the register plugin by given name.

func (*Engine) HTML

func (eng *Engine) HTML(method, url string, fn types.GetPanelInfoFn, noAuth ...bool)

HTML inject the route and corresponding handler wrapped by the given function to the web framework.

func (*Engine) HTMLFile

func (eng *Engine) HTMLFile(method, url, path string, data map[string]interface{}, noAuth ...bool)

HTMLFile inject the route and corresponding handler which returns the panel content of given html file path to the web framework.

func (*Engine) HTMLFiles

func (eng *Engine) HTMLFiles(method, url string, data map[string]interface{}, files ...string)

HTMLFiles inject the route and corresponding handler which returns the panel content of given html files path to the web framework.

func (*Engine) HTMLFilesNoAuth

func (eng *Engine) HTMLFilesNoAuth(method, url string, data map[string]interface{}, files ...string)

HTMLFilesNoAuth inject the route and corresponding handler which returns the panel content of given html files path to the web framework without auth check.

func (*Engine) MssqlConnection

func (eng *Engine) MssqlConnection() db.Connection

MssqlConnection return the mssql db connection of given driver.

func (*Engine) MysqlConnection

func (eng *Engine) MysqlConnection() db.Connection

MysqlConnection return the mysql db connection of given driver.

func (*Engine) OceanBaseConnection

func (eng *Engine) OceanBaseConnection() db.Connection

OceanBaseConnection return the OceanBase db connection of given driver.

func (*Engine) PostgresqlConnection

func (eng *Engine) PostgresqlConnection() db.Connection

PostgresqlConnection return the postgresql db connection of given driver.

func (*Engine) ResolveConnection

func (eng *Engine) ResolveConnection(setter ConnectionSetter, driver string) *Engine

ResolveConnection resolve the specified driver connection.

func (*Engine) ResolveMssqlConnection

func (eng *Engine) ResolveMssqlConnection(setter ConnectionSetter) *Engine

ResolveMssqlConnection resolve the mssql connection.

func (*Engine) ResolveMysqlConnection

func (eng *Engine) ResolveMysqlConnection(setter ConnectionSetter) *Engine

ResolveMysqlConnection resolve the mysql connection.

func (*Engine) ResolvePostgresqlConnection

func (eng *Engine) ResolvePostgresqlConnection(setter ConnectionSetter) *Engine

ResolvePostgresqlConnection resolve the postgres connection.

func (*Engine) ResolveSqliteConnection

func (eng *Engine) ResolveSqliteConnection(setter ConnectionSetter) *Engine

ResolveSqliteConnection resolve the sqlite connection.

func (*Engine) SetCaptcha

func (eng *Engine) SetCaptcha(captcha map[string]string) *Engine

SetCaptcha set the captcha config.

func (*Engine) SetCaptchaDriver

func (eng *Engine) SetCaptchaDriver(driver string) *Engine

SetCaptchaDriver set the captcha config with driver.

func (*Engine) SqliteConnection

func (eng *Engine) SqliteConnection() db.Connection

SqliteConnection return the sqlite db connection of given driver.

func (*Engine) Use

func (eng *Engine) Use(router interface{}) error

Use enable the adapter.

func (*Engine) User

func (eng *Engine) User(ctx interface{}) (models.UserModel, bool)

User call the User method of engine adapter.

type Setter

type Setter func(*Engine)

Jump to

Keyboard shortcuts

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