Documentation ¶
Index ¶
- func Handle(ctx *gin.Context, f func() interface{})
- func HandleResp(ctx *gin.Context, resp any)
- func NewBadRequestError(code int, err string) error
- func NewError(status, code int, msg string) error
- func NewForbiddenError(code int, err string) error
- func NewInternalServerError(code int, err string) error
- func NewNotFoundError(code int, err string) error
- func NewUnauthorizedError(code int, err string) error
- func RequestID(ctx context.Context) string
- type Error
- type JSONResponse
- type PageRequest
- type PageResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleResp ¶
func NewBadRequestError ¶
func NewForbiddenError ¶
func NewInternalServerError ¶
func NewNotFoundError ¶
func NewUnauthorizedError ¶
Types ¶
type Error ¶
type JSONResponse ¶
type PageRequest ¶
type PageRequest struct { // Deprecated 请使用方法GetPage Page int `form:"page" json:"page"` // Deprecated 请使用方法GetSize Size int `form:"size" json:"size"` // Deprecated 请使用方法GetSort Sort string `form:"sort" json:"sort"` // Deprecated 请使用方法GetOrder Order string `form:"order" json:"order"` }
PageRequest 使用UnmarshalJSON的方法来反序列化,避免使用用户传递的page和limit
func (*PageRequest) GetLimit ¶
func (p *PageRequest) GetLimit() int
func (*PageRequest) GetOffset ¶
func (p *PageRequest) GetOffset() int
func (*PageRequest) GetOrder ¶ added in v1.1.0
func (p *PageRequest) GetOrder() string
func (*PageRequest) GetPage ¶
func (p *PageRequest) GetPage() int
func (*PageRequest) GetSize ¶
func (p *PageRequest) GetSize() int
func (*PageRequest) GetSort ¶ added in v1.1.0
func (p *PageRequest) GetSort() string
type PageResponse ¶
Click to show internal directories.
Click to hide internal directories.