Idiomatic approach to UpdateIfExists conditions using sqlc #2010
-
DB: Mysql Use case:
What I am trying to do is use INSERT INTO ON DUPLICATE KEY as below When I run sqlc generate on my query, the params struct, and the corresponding method creates a duplicate value field with _2 naming convention. Eg:
Is there a right way to create a query as such or should break these into 2 separate queries ( INSERT INTO >> check for duplicate key error >> if err then as a response UPDATE) I cannot use INSERT IGNORE or REPLACE INTO for my use case. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
welp, just read on named parameters. Got the issue resolved. |
Beta Was this translation helpful? Give feedback.
welp, just read on named parameters. Got the issue resolved.