Documentation ¶
Index ¶
- func RegisterCalcService(e *echo.Echo, srv CalcService)
- func RegisterCalcServiceWithPrefix(e *echo.Echo, srv CalcService, prefix string)
- type AddError
- type AddReq
- type AddResp
- type AuthError
- type BindError
- type CalcService
- type CommonError
- type Empty
- type Extra
- type FieldError
- type GenericError
- type ValidateError
- type ValidateErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCalcService ¶
func RegisterCalcService(e *echo.Echo, srv CalcService)
RegisterCalcService is used to bind routers
func RegisterCalcServiceWithPrefix ¶
func RegisterCalcServiceWithPrefix(e *echo.Echo, srv CalcService, prefix string)
RegisterCalcServiceWithPrefix is used to bind routers with custom prefix
Types ¶
type AuthError ¶
type AuthError struct {
Message string `json:"message"`
}
AuthError
func (*AuthError) GetMessage ¶
type BindError ¶
type BindError struct {
Message string `json:"message"`
}
BindError
func (*BindError) GetMessage ¶
type CalcService ¶
type CalcService interface {
Add(c echo.Context, req *AddReq) (resp *AddResp, bizError *AddError, err error)
}
CalcService is the interface contains all the controllers
type CommonError ¶
type CommonError struct { GenericError *GenericError `json:"genericError"` AuthError *AuthError `json:"authError"` ValidateError *ValidateError `json:"validateError"` BindError *BindError `json:"bindError"` }
CommonError
func (*CommonError) GetAuthError ¶
func (r *CommonError) GetAuthError() *AuthError
func (*CommonError) GetBindError ¶
func (r *CommonError) GetBindError() *BindError
func (*CommonError) GetGenericError ¶
func (r *CommonError) GetGenericError() *GenericError
func (*CommonError) GetValidateError ¶
func (r *CommonError) GetValidateError() *ValidateError
type FieldError ¶
type FieldError struct { FieldName string `json:"fieldName"` ErrorType ValidateErrorType `json:"errorType"` }
FieldError
func (*FieldError) GetErrorType ¶
func (r *FieldError) GetErrorType() ValidateErrorType
func (*FieldError) GetFieldName ¶
func (r *FieldError) GetFieldName() string
type GenericError ¶
type GenericError struct {
Message string `json:"message"`
}
GenericError
func (*GenericError) GetMessage ¶
func (r *GenericError) GetMessage() string
type ValidateError ¶
type ValidateError struct {
Errors []*FieldError `json:"errors"`
}
ValidateError
func (*ValidateError) GetErrors ¶
func (r *ValidateError) GetErrors() []*FieldError
type ValidateErrorType ¶
type ValidateErrorType int
const ( INVALID_EMAIL ValidateErrorType = 0 FIELD_REQUIRED ValidateErrorType = 1 )
func (ValidateErrorType) Code ¶
func (code ValidateErrorType) Code() int
func (ValidateErrorType) IsFIELD_REQUIRED ¶
func (code ValidateErrorType) IsFIELD_REQUIRED() bool
func (ValidateErrorType) IsINVALID_EMAIL ¶
func (code ValidateErrorType) IsINVALID_EMAIL() bool
func (ValidateErrorType) String ¶
func (code ValidateErrorType) String() string
Click to show internal directories.
Click to hide internal directories.