Skip to content

Commit 8e9b453

Browse files
committed
validators null fix
1 parent a90ea9d commit 8e9b453

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/validation/validators.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func beforeValidator(match []string, value *generic.Value, stmt *gorm.Statement,
139139
}
140140

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

0 commit comments

Comments
 (0)