Skip to content

Commit

Permalink
fix unique validator
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Jun 10, 2024
1 parent 4c9746c commit 853dd4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/validation/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func uniqueValidator(match []string, value *generic.Value, stmt *gorm.Statement,
var c int64
var model = db.Table(stmt.Table).Where(field.DBName+" = ?", value.Input)
if !zero {
model = model.Where(stmt.Schema.PrioritizedPrimaryField.DBName+" = ?", of)
model = model.Where(stmt.Schema.PrioritizedPrimaryField.DBName+" != ?", of)
}
model.Count(&c)
if c > 0 {
Expand Down

0 comments on commit 853dd4e

Please sign in to comment.