controller

package
v0.0.0-...-6b90055 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SqlKeyDuplicateCode = 1062
	DataTooLongError    = 1406
)

mysql 错误码

Variables

This section is empty.

Functions

Types

type BaseController

type BaseController struct {
	Log *glog.Glogger
}

func NewBaseController

func NewBaseController(svc *svc.ControllerContext) BaseController

func (*BaseController) BindJSONIgnoreCase

func (m *BaseController) BindJSONIgnoreCase(ctx *gin.Context, req interface{}) (err error)

把请求参数转换为小写

func (*BaseController) GetRequestContext

func (m *BaseController) GetRequestContext(ctx *gin.Context) (*request.Context, error)

获取请求上下文

func (*BaseController) LimitLock

func (m *BaseController) LimitLock(ctx *gin.Context) error

IP限流

func (*BaseController) Response

func (m *BaseController) Response(ctx *gin.Context, code int, msg string, data interface{})

func (*BaseController) Response500

func (m *BaseController) Response500(ctx *gin.Context, res interface{})

func (*BaseController) ResponseError

func (m *BaseController) ResponseError(ctx *gin.Context, err error)

func (*BaseController) ResponseOk

func (m *BaseController) ResponseOk(ctx *gin.Context, data interface{})

func (*BaseController) ShouldBind

func (m *BaseController) ShouldBind(ctx *gin.Context, req interface{}) error

func (*BaseController) ShouldBindJSON

func (m *BaseController) ShouldBindJSON(ctx *gin.Context, req interface{}) error

func (*BaseController) ShouldBindQuery

func (m *BaseController) ShouldBindQuery(ctx *gin.Context, req interface{}) error

func (*BaseController) StreamResponse

func (m *BaseController) StreamResponse(c *gin.Context, data string)

type IsValidChecker

type IsValidChecker interface {
	IsValid() error
}

Jump to

Keyboard shortcuts

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