We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
goqu:"omitempty"
Describe the bug I want to omit the zerovalue string. I am using example mentioned code.
zerovalue
To Reproduce
type item struct { FirstName string `db:"first_name" goqu:"omitempty"` LastName string `db:"last_name" goqu:"omitempty"` Address1 *string `db:"address1" goqu:"omitempty"` Address2 *string `db:"address2" goqu:"omitempty"` Address3 *string `db:"address3" goqu:"omitempty"` } address1 := "114 Test Addr" var emptyString string sql, args, _ := goqu.Update("items").Set( item{ FirstName: "Test First Name", LastName: "", // will omit zero field Address1: &address1, Address2: &emptyString, Address3: nil, // will omit nil pointer }, ).ToSQL() fmt.Println(sql, args)
Actual Output
UPDATE "items" SET "address1"='114 Test Addr',"address2"='',"address3"=NULL,"first_name"='Test First Name',"last_name"='' []
Expected behavior The last name should not add.
UPDATE "items" SET "address1"='114 Test Addr',"address2"='',"first_name"='Test First Name' []
Dialect:
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
goqu:"omitempty
Got same bug in v9.18.0. v9.19.0 is OK
Sorry, something went wrong.
Can confirm that also worked for me on v9.19.0
No branches or pull requests
Describe the bug
I want to omit the
zerovalue
string. I am using example mentioned code.To Reproduce
Actual Output
Expected behavior
The last name should not add.
Dialect:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: