engine

package
v0.0.0-...-35d01cd Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonError

func JsonError(ctx *Context, data interface{}, err error)

func JsonResult

func JsonResult(ctx *Context, data interface{})

func SetMode

func SetMode(mode string)

Types

type Context

type Context struct {
	Context *gin.Context
}

func (*Context) Bind

func (c *Context) Bind(i interface{}) error

func (*Context) ImageResult

func (c *Context) ImageResult(b []byte, s string)

func (*Context) PostBody

func (c *Context) PostBody() map[string]interface{}

func (*Context) Query

func (c *Context) Query(key string) string

func (*Context) TextResult

func (c *Context) TextResult(b []byte)

type Engine

type Engine struct {
	*RouteGroup
	// contains filtered or unexported fields
}

func NewDefaultEngine

func NewDefaultEngine() *Engine

func (*Engine) LoadHTMLFiles

func (e *Engine) LoadHTMLFiles(files ...string)

func (*Engine) LoadHTMLGlob

func (e *Engine) LoadHTMLGlob(pattern string)

func (*Engine) Run

func (e *Engine) Run(addr string) error

func (*Engine) RunTLS

func (e *Engine) RunTLS(addr string, certFile string, keyFile string) error

type Handle

type Handle func(*Context) (interface{}, error)

func Result

func Result(h Handle) Handle

type InitFunc

type InitFunc interface {
	Done(*RouteGroup, string, string, Handle) error
}

type Middleware

type Middleware func(Handle) Handle

type RouteGroup

type RouteGroup struct {
	Path string
	// contains filtered or unexported fields
}

func (*RouteGroup) GET

func (r *RouteGroup) GET(path, name string, h Handle)

func (*RouteGroup) Group

func (g *RouteGroup) Group(path string) *RouteGroup

func (*RouteGroup) Init

func (r *RouteGroup) Init(b InitFunc) *RouteGroup

func (*RouteGroup) POST

func (r *RouteGroup) POST(path, name string, h Handle)

func (*RouteGroup) Static

func (r *RouteGroup) Static(path, dir string)

func (*RouteGroup) StaticFs

func (r *RouteGroup) StaticFs(path string, fs http.FileSystem)

func (*RouteGroup) Use

func (r *RouteGroup) Use(middleware ...Middleware) *RouteGroup

Jump to

Keyboard shortcuts

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