Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 馃悰 embedded struct test failed with custom datatypes #6311

Conversation

aclich
Copy link
Contributor

@aclich aclich commented May 11, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Refer to #6288
Fix embedded struct with custom datatypes and *time.time will failed the test.

User Case Description

Test should pass.

@aclich aclich force-pushed the fix/custom-datatypes-cause-embedded-struct-not-nil branch from cd35429 to f742914 Compare May 11, 2023 03:31
@aclich aclich marked this pull request as draft May 11, 2023 06:17
Fix the pointer embedded struct within custom datatypes and *time.time
should be nil issue.
@aclich aclich force-pushed the fix/custom-datatypes-cause-embedded-struct-not-nil branch from f742914 to 1f76872 Compare May 11, 2023 06:43
@aclich
Copy link
Contributor Author

aclich commented May 11, 2023

mssql will have type issue while inserting null value into varbinary(max) type.

/home/diad/Developer/hbs4/gorm/tests/embedded_struct_test.go:130 mssql: Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
[16347.552ms] [rows:0] INSERT INTO "hn_posts" ("title","url","upvotes","user_id","user_name","user_email","user_age","user_content","user_content_ptr","user_birthday","user_birthday_ptr") OUTPUT INSERTED."id" VALUES ('embedded_pointer_type','',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

reference https://stackoverflow.com/questions/11411854/implicit-conversion-from-data-type-nvarchar-to-varbinarymax-is-not-allowed
Probably same issue as denisenkom/go-mssqldb#530, need a driver fix.

@aclich aclich closed this May 11, 2023
change test cases from bytes to string to avoid mssql driver issue
@aclich
Copy link
Contributor Author

aclich commented May 12, 2023

commit dc149c1
Modify the custom datatypes to string for preventing mssql driver issue.
Reopen PR, fixing embedded struct should be nil.

@aclich aclich reopened this May 12, 2023
@aclich aclich marked this pull request as ready for review May 12, 2023 04:52
@jinzhu jinzhu merged commit 6353414 into go-gorm:master May 15, 2023
49 checks passed
@turip turip mentioned this pull request Feb 13, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants