engine

package
v0.0.0-...-0b7460b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	SetGinContext(ctx *gin.Context)
	GetGinContext() *gin.Context
	ResponseParseParamsFieldFail(path string, uri string, body string, field string, value string, err error)
}

type Engine

type Engine struct {
	Addr string

	GroupRoutes map[string]*RouterGroup // 组路由
	Routes      map[string]*RouteInfo   // 直接路由
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(addr string, newContextFun func() Context) *Engine

func (*Engine) EnableDebugMode

func (e *Engine) EnableDebugMode()

func (*Engine) Get

func (e *Engine) Get(path string, desc string, handlers ...HandlerFunc) gin.IRoutes

func (*Engine) GetGinEngine

func (e *Engine) GetGinEngine() *gin.Engine

func (*Engine) GetWithStructParams

func (e *Engine) GetWithStructParams(path string, desc string, structTemplate interface{}, handlers ...HandlerFunc) gin.IRoutes

func (*Engine) Group

func (e *Engine) Group(path string, handlers ...HandlerFunc) *RouterGroup

func (*Engine) Post

func (e *Engine) Post(path string, desc string, handlers ...HandlerFunc) gin.IRoutes

func (*Engine) PostWithStructParams

func (e *Engine) PostWithStructParams(path string, desc string, structTemplate interface{}, handlers ...HandlerFunc) gin.IRoutes

func (*Engine) Run

func (e *Engine) Run() error

func (*Engine) Stop

func (e *Engine) Stop()

func (*Engine) TravelGroupTree

func (e *Engine) TravelGroupTree() map[string]*RouteInfo

func (*Engine) Use

func (e *Engine) Use(middleware ...HandlerFunc)

func (*Engine) WithLogger

func (e *Engine) WithLogger(logger Logger) *Engine

type HandlerFunc

type HandlerFunc interface{}

type HandlerFunc func(ctx Context)

type Logger

type Logger interface {
	HandleRequest(ctx Context, params *gin.LogFormatterParams)
}

type RouteInfo

type RouteInfo struct {
	Desc           string
	Method         string
	StructTemplate interface{}
}

func (*RouteInfo) HasFields

func (ri *RouteInfo) HasFields() bool

func (*RouteInfo) JsonStructDesc

func (ri *RouteInfo) JsonStructDesc() []*fieldDescInfo

func (*RouteInfo) String

func (ri *RouteInfo) String() string

type RouterGroup

type RouterGroup struct {
	GroupRoutes map[string]*RouterGroup
	Routes      map[string]*RouteInfo

	UnmarshalHandler unmarshal
	// contains filtered or unexported fields
}

func (*RouterGroup) Get

func (g *RouterGroup) Get(path string, desc string, handlers ...HandlerFunc) gin.IRoutes

func (*RouterGroup) GetWithStructParams

func (g *RouterGroup) GetWithStructParams(path string, desc string, structTemplate interface{}, handlers ...HandlerFunc) gin.IRoutes

func (*RouterGroup) Group

func (g *RouterGroup) Group(path string, handlers ...HandlerFunc) *RouterGroup

func (*RouterGroup) Post

func (g *RouterGroup) Post(path string, desc string, handlers ...HandlerFunc) gin.IRoutes

func (*RouterGroup) PostWithStructParams

func (g *RouterGroup) PostWithStructParams(path string, desc string, structTemplate interface{}, handlers ...HandlerFunc) gin.IRoutes

func (*RouterGroup) SetUnmarshalHandler

func (g *RouterGroup) SetUnmarshalHandler(handlerFunc unmarshal) *RouterGroup

func (*RouterGroup) TravelGroupTree

func (g *RouterGroup) TravelGroupTree() map[string]*RouteInfo

func (*RouterGroup) Use

func (g *RouterGroup) Use(middleware ...HandlerFunc)

Jump to

Keyboard shortcuts

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