bingo

package
v0.0.0-...-a4ab4b0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnStart    event.Event = "OnStart"
	OnShutdown event.Event = "OnShutdown"
	OnPanic    event.Event = "OnPanic"
)
View Source
const SIGNAL = "signal"

Variables

View Source
var Injecter *inject.Injecter

Functions

func RecoverHandler

func RecoverHandler() gin.HandlerFunc

Types

type Bingo

type Bingo struct {
	Router
	// contains filtered or unexported fields
}

func New

func New() *Bingo

func (*Bingo) Configs

func (bingo *Bingo) Configs(objs ...interface{}) *Bingo

Configs 用于初始化 会对对象进行注入 并且自动调用obj的所有方法,把返回值加入 Injecter

func (*Bingo) InjectCtl

func (bingo *Bingo) InjectCtl(ctls ...Controller) *Bingo

InjectCtl 注入控制器 会对控制器进行依赖注入,并且调用 Controller.BuildHandle 注册路由

func (*Bingo) Listener

func (bingo *Bingo) Listener(e BingoEvent) *Bingo

监听框架全局事件

func (*Bingo) Pprof

func (bingo *Bingo) Pprof(port int) *Bingo

func (*Bingo) Run

func (bingo *Bingo) Run(port int)

type BingoEvent

type BingoEvent interface {
	OnStart(data *event.EventData)
	OnShutdown(data *event.EventData)
	OnPanic(data *event.EventData)
}

type Controller

type Controller interface {
	BuildHandle(g *Bingo)
}

type Json

type Json interface{}

type JsonResponder

type JsonResponder func(*gin.Context) (Json, error)

func (JsonResponder) Handle

func (jsonFunc JsonResponder) Handle(context *gin.Context)

type Responder

type Responder interface {
	Handle(ctx *gin.Context)
}

type Router

type Router struct {
	*gin.RouterGroup
	// contains filtered or unexported fields
}

func (*Router) Any

func (r *Router) Any(path string, handler interface{})

func (*Router) Group

func (r *Router) Group(path string, handlerFunc ...gin.HandlerFunc) *Router

func (*Router) Handle

func (r *Router) Handle(method string, path string, handler interface{})

Handle 注册路由

func (*Router) Use

func (r *Router) Use(handlerFunc ...gin.HandlerFunc) *Bingo

type TextResponder

type TextResponder func(*gin.Context) (string, error)

func (TextResponder) Handle

func (TextFunc TextResponder) Handle(context *gin.Context)

type VoidResponder

type VoidResponder func(*gin.Context) error

func (VoidResponder) Handle

func (voidFunc VoidResponder) Handle(context *gin.Context)

type Xml

type Xml interface{}

type XmlResponder

type XmlResponder func(*gin.Context) (Xml, error)

func (XmlResponder) Handle

func (xmlFunc XmlResponder) Handle(context *gin.Context)

Jump to

Keyboard shortcuts

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