vegeRouter

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SendOk      = "SendOk"
	SendBad     = "SendBad"
	CheckAuth   = "CheckAuth"
	UriToFnName = "UriToFnName"
)
View Source
const (
	PathUri = "*" + uri
)

Variables

This section is empty.

Functions

func Call

func Call(ctx *gin.Context, service any, methodName string) (response any, err error)

业务中的panic可以通过gin.Recivery打印到gin.DefaultErrorWriter中

func RegApiHandler

func RegApiHandler(bind Register) gin.HandlerFunc

RegApiHandler 根据*uri执行对应方法,req自动从body中取得,其他参数可以自己从ctx中获取

Types

type Register added in v1.0.8

type Register interface {
	//200
	SendOk(c *gin.Context, body any)
	//500
	SendBad(c *gin.Context, errMsg string)
	//401
	CheckAuth(c *gin.Context) error
	//map[uri]fnName
	UriToFnName(uri string) string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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