1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-08-06 22:32:51 +02:00

Fixed validation errors

This commit is contained in:
Lee Brown
2019-08-02 16:10:30 -08:00
parent c625ace88d
commit b6069de9cf
8 changed files with 43 additions and 11 deletions

View File

@ -154,7 +154,17 @@ func newValidator() *validator.Validate {
if fl.Field().String() == "invalid" {
return false
}
return ctx.Value(KeyTagUnique).(bool)
cv := ctx.Value(KeyTagUnique)
if cv == nil {
return false
}
if v, ok := cv.(bool); ok {
return v
}
return false
}
v.RegisterValidationCtx("unique", fctx)