Documentation ¶
Index ¶
- func Body(ctx *gin.Context, thenFunc noReqNoRespThenFunc)
- func BodyReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ])
- func BodyReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP])
- func BodyResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP])
- func BytesToString(b []byte) string
- func Cors() gin.HandlerFunc
- func Form(ctx *gin.Context, thenFunc noReqNoRespThenFunc)
- func FormReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ])
- func FormReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP])
- func FormResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP])
- func GetApp() *gin.Engine
- func GetAppWithGroup(prefix string) *gin.RouterGroup
- func MapFormWithTag(ptr any, form map[string][]string, tag string) error
- func Pagination(db *gorm.DB, req PageReq, count *int64, list any) (err error)
- func Query(ctx *gin.Context, thenFunc noReqNoRespThenFunc)
- func QueryReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ])
- func QueryReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP])
- func QueryResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP])
- func StringToBytes(s string) []byte
- func WriteBindCodeSimple(httpCode int, ctx *gin.Context, str string)
- func WriteBindError(ctx *gin.Context, err error)
- func WriteJSON(ctx *gin.Context, code, httpCode int, msg string, err error, data any)
- func WriteJSONSimple(ctx *gin.Context, err error)
- func WriteServerErrorJSON(ctx *gin.Context, err error)
- func WriteSuccessJSON(ctx *gin.Context, data any)
- type Error
- type ID
- type IDs
- type PageReq
- type PageResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyReqResp ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func Cors ¶ added in v1.0.1
func Cors() gin.HandlerFunc
func FormReqResp ¶
func GetAppWithGroup ¶ added in v1.0.1
func GetAppWithGroup(prefix string) *gin.RouterGroup
func QueryReqResp ¶
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func WriteBindError ¶
func WriteJSONSimple ¶
func WriteServerErrorJSON ¶
func WriteSuccessJSON ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewErrorWithCode ¶
func NewErrorWithHttpCode ¶
type ID ¶ added in v1.0.2
type ID struct {
ID int `json:"id" form:"id" validate:"min(1,入参ID不能为空)"`
}
type IDs ¶ added in v1.0.2
type IDs struct {
IDs []int `json:"ids" form:"ids" validate:"minlength(1,入参ID不能为空)"`
}
Click to show internal directories.
Click to hide internal directories.