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

func foreignKeyValidator(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() == "" && value.String() == "<nil>" {
return nil
}
var c int64
Expand Down

0 comments on commit a90ea9d

Please sign in to comment.