adapter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseAdapter

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

BaseAdapter is a base adapter contains some helper functions.

func (*BaseAdapter) CookieKey

func (*BaseAdapter) CookieKey() string

CookieKey return the cookie key.

func (*BaseAdapter) DisableLog

func (*BaseAdapter) DisableLog()

func (*BaseAdapter) GetConnection

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

GetConnection get the db connection.

func (*BaseAdapter) GetContent

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

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

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

func (*BaseAdapter) HTMLContentType() string

HTMLContentType return the default content type header.

func (*BaseAdapter) Run

func (*BaseAdapter) Run() error

func (*BaseAdapter) SetConnection

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

SetConnection set the db connection.

func (*BaseAdapter) Static

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
	Request() *http.Request
	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