Documentation
¶
Index ¶
- Constants
- Variables
- func GetJSONTag(fld reflect.StructField) string
- func HTTPErrorResponse(c echo.Context, e error) error
- func Is(e KisaError, k Kind) bool
- type FieldValidationError
- type Kerror
- type Kind
- type KisaError
- func BindError(err error, message string) KisaError
- func DatabaseError(err error, log logam.Logger) KisaError
- func ForbidenError(message string, err error) KisaError
- func InternalServerError(err error) KisaError
- func InvalidApiKeyError(err error) KisaError
- func InvalidAuthMethodError(err error) KisaError
- func InvalidJWTClaimsError(err error) KisaError
- func InvalidKeyAttributesError(err error) KisaError
- func InvalidRequestError(message string, err error) KisaError
- func InvalidTokenError(err error) KisaError
- func NoTokenError(err error) KisaError
- func NotFoundError(message string, err error) KisaError
- func ResourceConflictError(message string, err error) KisaError
- func UnauthorizedError(message string, err error) KisaError
- func ValidationError(err validationFields) KisaError
- type LogContext
- type Validator
Constants ¶
View Source
const ( EmailRegexPattern = `^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$` PhoneRegexPattern = `^\+?[1-9]\d{10,15}$` PinRegexPattern = `^\d{4,12}$` PasswordRegexPattern = `^(?=.*[A-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[*@$!%*#?&])\S{8,}$` )
Variables ¶
View Source
var ( RegexpEmail = regexp2.MustCompile(EmailRegexPattern, 0) RegexpPhone = regexp2.MustCompile(PhoneRegexPattern, 0) RegexPassword = regexp2.MustCompile(PasswordRegexPattern, 0) RegexPin = regexp2.MustCompile(PinRegexPattern, 0) )
Functions ¶
func GetJSONTag ¶
func GetJSONTag(fld reflect.StructField) string
GetJSONTag will return the value of the json tag of the field. This func can be passed as argument to validate.RegisterTagNameFunc
Types ¶
type FieldValidationError ¶
func (FieldValidationError) MarshalJSON ¶
func (f FieldValidationError) MarshalJSON() ([]byte, error)
type Kerror ¶
type Kerror struct {
Status int
Kind string
Message string
Fields map[string]string
// contains filtered or unexported fields
}
func (Kerror) GetMessage ¶
func (Kerror) GetValidationFields ¶
type KisaError ¶
type KisaError interface {
Error() string
GetMessage() string
Code() int
With(...interface{}) KisaError
GetValidationFields() map[string]string
GetKind() string
// contains filtered or unexported methods
}
func ForbidenError ¶
func InternalServerError ¶
func InvalidApiKeyError ¶
func InvalidAuthMethodError ¶
func InvalidJWTClaimsError ¶
func InvalidRequestError ¶
func InvalidTokenError ¶
func NoTokenError ¶
func NotFoundError ¶
func ResourceConflictError ¶
func UnauthorizedError ¶
func ValidationError ¶
func ValidationError(err validationFields) KisaError
type LogContext ¶
type LogContext map[string]interface{}
Click to show internal directories.
Click to hide internal directories.