web

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(ctx *Context) error

Log 默认日志中间件

func Recover

func Recover(ctx *Context) error

Recover 默认崩溃恢复中间件

Types

type Context

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

func (*Context) Fail

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

func (*Context) Json

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

func (*Context) Success

func (ctx *Context) Success(data interface{}) error

type Engine

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

func NewEngine

func NewEngine() *Engine

func (*Engine) Get

func (e *Engine) Get(pattern string, srv Service)

Get register router

func (*Engine) Group

func (e *Engine) Group(prefix string) *RouteGroup

func (*Engine) Run

func (e *Engine) Run() error

func (*Engine) ServeHTTP

func (e *Engine) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type RouteGroup

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

func NewRouteGroup

func NewRouteGroup(prefix string, e *Engine) *RouteGroup

func (*RouteGroup) Get

func (r *RouteGroup) Get(pattern string, srv Service)

func (*RouteGroup) Use

func (r *RouteGroup) Use(srv Service)

type Service

type Service func(ctx *Context) error

type Tire

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

func NewTire

func NewTire() *Tire

func (*Tire) AddHandler

func (t *Tire) AddHandler(path string, handler Service) *Tire

func (*Tire) Display

func (t *Tire) Display()

func (*Tire) GetHandler

func (t *Tire) GetHandler(path string) Service

GetHandler 匹配路由

func (*Tire) Level

func (t *Tire) Level() int64

Level 获取树的层数

Jump to

Keyboard shortcuts

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