Skip to content

Commit

Permalink
validators null fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Oct 21, 2024
1 parent a90ea9d commit 8e9b453
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 @@ -139,7 +139,7 @@ func beforeValidator(match []string, value *generic.Value, stmt *gorm.Statement,
}

func uniqueValidator(match []string, value *generic.Value, stmt *gorm.Statement, field *schema.Field) error {
if field.StructField.Type.Kind() == reflect.Ptr && value.String() == "<nil>" {
if field.StructField.Type.Kind() == reflect.Ptr && value.String() == "<nil>" && value.String() == "" {
return nil
}
if !field.Unique && value.String() == "" {
Expand Down

0 comments on commit 8e9b453

Please sign in to comment.