handlers

package
v0.0.0-...-2327f32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCodeBadRequest                       = "BadRequest"
	ErrorCodeResourceNotFound                 = "ResourceNotFound"
	ErrorCodeDbException                      = "DatabaseException"
	ErrorCodeForbidden                        = "Forbidden"
	ErrorCodeResourceConflict                 = "ResourceConflict"
	ErrorCodeRouteNotDefined                  = "RouteNotDefined"
	ErrorCodeInternalServerError              = "InternalServerError"
	ErrorCodeExternalServiceUnavailable       = "ExternalServiceUnavailable"
	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 HealthCheck(ctx *gin.Context)

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL