-
-
Notifications
You must be signed in to change notification settings - Fork 233
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NewUpdate SET ignores nullzero #339
Comments
It requires explicit pointer using *string
*uuid.UUID
*time.Time |
This is working as expected. OmitZero only works with updates and only when using |
@vmihailenco Result SQL with UPDATE "users" AS "user" SET first_name = '', profile_id = '00000000-0000-0000-0000-000000000000', deleted_at = '0001-01-01 00:00:00+00:00', document_ids = 'null' WHERE (true) Result SQL with UPDATE "users" AS "user" SET "first_name" = NULL, "profile_id" = NULL, "deleted_at" = NULL, "document_ids" = NULL WHERE (true) p.s. It's a challenge to migrate from go-pg. Not because of change of huge codebase, but because of such pitfalls. |
fix: respect nullzero when appending struct fields. Fixes #339
That is a bug / overlook and it should be fixed by #339. Please try master branch. |
@vmihailenco thanks a lot |
nullzero
behaves differently atNewInsert
,NewUpdate
.OmitZero()
has no impact onNewUpdate
that usesSet
method.NewInsert
will produce SQL wherenullzero
values replaced withDEFAULT
, butNewUpdate
will replace with default value of type.Set
ignoresnullzero
:Column
appliesnullzero
:The text was updated successfully, but these errors were encountered: