Documentation ¶
Index ¶
- Constants
- func EncodeQuery(param map[string]string) string
- func ErrorHandleMiddleware() gin.HandlerFunc
- func JsonResponse(c *gin.Context, httpCode int, code int, obj any)
- func RegisterCRUDApi(route *gin.Engine, pathPrefix string, api CRUDApi, ...)
- func Response(c *gin.Context, obj any)
- func ResponseError(c *gin.Context, err error)
- type CRUDApi
- type Code
- type ErrorResponse
- type Middleware
Constants ¶
View Source
const ( Success = "success" Error = "error" Status = "status" )
Variables ¶
This section is empty.
Functions ¶
func EncodeQuery ¶ added in v1.7.0
func ErrorHandleMiddleware ¶ added in v1.7.0
func ErrorHandleMiddleware() gin.HandlerFunc
func JsonResponse ¶ added in v1.7.0
func RegisterCRUDApi ¶
func ResponseError ¶
Types ¶
type ErrorResponse ¶ added in v1.7.0
type ErrorResponse struct { HttpStatus int // in: body Payload struct { // error code Code int `json:"code"` // error message Message string `json:"message"` } `json:"body"` // contains filtered or unexported fields }
swagger:response errorResponse
func NewErrorResponse ¶ added in v1.7.0
func NewErrorResponse() *ErrorResponse
func (*ErrorResponse) WithError ¶ added in v1.7.0
func (r *ErrorResponse) WithError(err error) *ErrorResponse
func (*ErrorResponse) WriteResponse ¶ added in v1.7.0
func (r *ErrorResponse) WriteResponse(ctx *gin.Context)
Click to show internal directories.
Click to hide internal directories.