adapter

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 14 Imported by: 10

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 (base *BaseAdapter) CookieKey() string

CookieKey return the cookie key.

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)

GetContent is a helper function of adapter.Content

func (*BaseAdapter) GetUse

func (base *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 (base *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 (base *BaseAdapter) HTMLContentType() string

HTMLContentType return the default content type header.

func (*BaseAdapter) SetConnection

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

SetConnection set the db connection.

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, 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)

	SetApp(app interface{}) error
	SetConnection(db.Connection)
	GetConnection() db.Connection
	SetContext(ctx interface{}) WebFrameWork
	GetCookie() (string, error)
	Path() string
	Method() string
	FormParam() 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