adapter

package
v1.2.25 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAdapter added in v1.2.25

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

BaseAdapter is a base adapter contains some helper functions.

func (*BaseAdapter) CookieKey added in v1.2.25

func (*BaseAdapter) CookieKey() string

CookieKey return the cookie key.

func (*BaseAdapter) DisableLog added in v1.2.25

func (*BaseAdapter) DisableLog()

func (*BaseAdapter) GetConnection added in v1.2.25

func (base *BaseAdapter) GetConnection() db.Connection

GetConnection get the db connection.

func (*BaseAdapter) GetContent added in v1.2.25

func (base *BaseAdapter) GetContent(ctx interface{}, getPanelFn types.GetPanelFn, wf WebFrameWork,
	navButtons types.Buttons, fn context.NodeProcessor)

GetContent is a helper function of adapter.Content

func (*BaseAdapter) GetUse added in v1.2.25

func (*BaseAdapter) GetUse(app interface{}, plugin []plugins.Plugin, wf WebFrameWork) error

GetUse is a helper function adds the plugins to the framework.

func (*BaseAdapter) GetUser added in v1.2.25

func (*BaseAdapter) GetUser(ctx interface{}, wf WebFrameWork) (models.UserModel, bool)

GetUser is a helper function get the auth user model from the context.

func (*BaseAdapter) HTMLContentType added in v1.2.25

func (*BaseAdapter) HTMLContentType() string

HTMLContentType return the default content type header.

func (*BaseAdapter) Run added in v1.2.25

func (*BaseAdapter) Run() error

func (*BaseAdapter) SetConnection added in v1.2.25

func (base *BaseAdapter) SetConnection(conn db.Connection)

SetConnection set the db connection.

func (*BaseAdapter) Static added in v1.2.25

func (*BaseAdapter) Static(_, _ string)

type WebFrameWork

type WebFrameWork interface {
	// Name return the web framework name.
	Name() string

	// Use method inject the plugins to the web framework engine which is the
	// first parameter.
	Use(app interface{}, plugins []plugins.Plugin) error

	// Content add the panel html response of the given callback function to
	// the web framework context which is the first parameter.
	Content(ctx interface{}, fn types.GetPanelFn, fn2 context.NodeProcessor, navButtons ...types.Button)

	// User get the auth user model from the given web framework context.
	User(ctx interface{}) (models.UserModel, bool)

	// AddHandler inject the route and handlers of GoAdmin to the web framework.
	AddHandler(method, path string, handlers context.Handlers)

	DisableLog()

	Static(prefix, path string)

	Run() error

	SetApp(app interface{}) error
	SetConnection(db.Connection)
	GetConnection() db.Connection
	SetContext(ctx interface{}) WebFrameWork
	GetCookie() (string, error)
	Lang() string
	Path() string
	Method() string
	FormParam() url.Values
	Query() url.Values
	IsPjax() bool
	Redirect()
	SetContentType()
	Write(body []byte)
	CookieKey() string
	HTMLContentType() string
}

WebFrameWork is an interface which is used as an adapter of framework and goAdmin. It must implement two methods. Use registers the routes and the corresponding handlers. Content writes the response to the corresponding context of framework.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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