Documentation ¶
Index ¶
Constants ¶
View Source
const (
ErrorTypeErrorValidation string = "validator.ValidationErrors"
)
const list
Variables ¶
View Source
var (
ErrorInternalError = errors.New("whoops something went wrong")
)
var list
View Source
var ValidationObject = []ExtraValidation{
{Tag: "required", Message: "%s is required!"},
{Tag: "max", Message: "%s cannot be more than %s!"},
{Tag: "min", Message: "%s must be minimum %s!"},
{Tag: "email", Message: "Invalid email format!"},
{Tag: "len", Message: "%s must be %s characters long!"},
}
ValidationObject initialize default Validation object
Functions ¶
func Errors ¶
func Errors() gin.HandlerFunc
Errors method collects all errors and submits them to Rollbar
func MakeExtraValidation ¶
func MakeExtraValidation(v []ExtraValidation)
MakeExtraValidation method is for registering new validator
func ValidationErrorToText ¶
func ValidationErrorToText(e validator.FieldError) string
ValidationErrorToText method changes FieldError to string
Types ¶
type ExtraValidation ¶
ExtraValidation model
Click to show internal directories.
Click to hide internal directories.