Documentation ¶
Index ¶
- Constants
- func NewData(ctx *gin.Context, status int, data interface{})
- func NewError(ctx *gin.Context, status int, err error)
- func NewResponse(ctx *gin.Context, status int, obj interface{})
- func NewValidationError(ctx *gin.Context, err error)
- func ValidateBody(ctx *gin.Context, obj interface{}) error
- func ValidateUUID(id string) (uuid.UUID, error)
- type DataResponse
- type ErrorResponse
- type ValidationErrorResponse
Constants ¶
View Source
const (
ValidationErrorCode int = 400
)
Variables ¶
This section is empty.
Functions ¶
func NewResponse ¶
NewResponse returns a new response
func NewValidationError ¶
NewValidationError returns a new validation error response
func ValidateBody ¶
Types ¶
type DataResponse ¶
type DataResponse struct { Code int `json:"code" example:"200"` Data interface{} `json:"data,omitempty"` }
DataResponse example
type ErrorResponse ¶
type ErrorResponse struct { Code int `json:"code" example:"400"` Message string `json:"message" example:"status bad request"` }
ErrorResponse represents an error API response
Click to show internal directories.
Click to hide internal directories.