Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrorCodeBadRequest = "BadRequest" ErrorCodeResourceNotFound = "ResourceNotFound" ErrorCodeDbException = "DatabaseException" ErrorCodeForbidden = "Forbidden" ErrorCodeResourceConflict = "ResourceConflict" ErrorCodeRouteNotDefined = "RouteNotDefined" ErrorCodeInternalServerError = "InternalServerError" ErrorCodeUnsupportedMediaType = "UnsupportedMediaType" ErrorCodeInvalidRequestBody = "InvalidRequestBody" ErrorCodeInvalidRequestUri = "InvalidRequestUri" ErrorCodeInvalidRequestMessageFraming = "InvalidRequestMessageFraming" ErrorCodeBusinessRuleViolation = "BusinessRuleViolation" ErrorCodeNotImplemented = "NotImplemented" ErrorCodeInvalidAuthorizationHeaderFormat = "ErrorCodeInvalidAuthorizationHeaderFormat" ErrorCodeAuthorizationHeaderEmpty = "AuthorizationHeaderEmpty" ErrorCodeInvalidRequestParameter = "InvalidRequestParameter" )
View Source
const ( ErrorMsgBadRequest = "bad request" ErrorMsgModifyPayload = "please modify the payload based on the information provided in the details" ErrorMsgModifyUri = "please modify the uri based on the information provided in the details" ErrorMsgFieldRequired = "the field is required" ErrorMsgFieldDisableInput = "the field is not allowed for input" ErrorMsgFieldInvalidFormat = "invalid format" ErrorMsgFieldInvalidValue = "invalid value" ErrorMsgFieldTooShort = "the value is out of range or the length is too short" ErrorMsgFieldTooLong = "the value is out of range or the length is too long" ErrorMsgFieldNotAscii = "the value should only contain English letters, numbers and punctuation marks" ErrorMsgFieldNotEqual = "the value should be equal to the specified value" ErrorMsgExecuteSQLTimeout = "execute SQL script timeout" ErrorMsgResourceNotFound = "resource is not found" ErrorMsgRouteNotDefined = "the route is not defined" ErrorMsgRequestBodyTypeIncorrect = "the type is incorrect or the value is out of range" )
Variables ¶
This section is empty.
Functions ¶
func HealthCheck ¶
func ToErrorResponse ¶
func ToErrorResponse(err ResponseError) map[string]any
Types ¶
type InternalHandler ¶
type InternalHandler struct{}
func NewInternalHandler ¶
func NewInternalHandler() *InternalHandler
func (*InternalHandler) PostHello ¶
func (h *InternalHandler) PostHello(ctx *gin.Context)
type PostHelloRequest ¶
type PostHelloRequest struct {
Message string `json:"message" validate:"required"`
}
type ResponseError ¶
type ResponseError struct { StatusCode int `json:"-"` Code string `json:"code" example:"ResourceNotFound"` Message string `json:"message" example:"license is not found"` Target string `json:"target,omitempty" example:"subscription"` Details interface{} `json:"details,omitempty" swaggerignore:"true"` BatchResult interface{} `json:"batch_result,omitempty" swaggerignore:"true"` }
func ValidatePayload ¶
func ValidatePayload(c *gin.Context, schema interface{}) *ResponseError
type Validator ¶
type Validator interface {
Validate() []*ResponseError
}
Click to show internal directories.
Click to hide internal directories.