-
Database schema create table users
(
name uuid not null,
emails varchar()[] not null
); SQL queries -- name: AddEmail :exec
UPDATE users
SET emails = $1 || emails
WHERE name = $2; update users SET emails = '{abc@test.com}' || emails where name = 'john' The generated code now type AddEmailsParams struct {
emails []string
Code string
} Does every update need to read all the data in the email field in advance? |
Beta Was this translation helpful? Give feedback.
Answered by
renjunok
Aug 6, 2023
Replies: 1 comment
-
-- name: AddEmail :exec
UPDATE users
SET emails = $1::varchar() || emails
WHERE name = $2; should be written like this |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
renjunok
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should be written like this