Skip to content

Commit a90ea9d

Browse files
committed
validators null fix
1 parent 63c91d6 commit a90ea9d

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
@@ -160,7 +160,7 @@ func uniqueValidator(match []string, value *generic.Value, stmt *gorm.Statement,
160160
}
161161

162162
func foreignKeyValidator(match []string, value *generic.Value, stmt *gorm.Statement, field *schema.Field) error {
163-
if field.StructField.Type.Kind() == reflect.Ptr && value.String() == "<nil>" {
163+
if field.StructField.Type.Kind() == reflect.Ptr && value.String() == "" && value.String() == "<nil>" {
164164
return nil
165165
}
166166
var c int64

0 commit comments

Comments
 (0)