help:How can this SQL statement be changed to an SQLC statement? #1572
Unanswered
bytegolang
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The tricky part is this section: for _, p := range roleApis {
db = db.Or("system_api.url = ? and system_api.method = ?", p[1], p[2])
} Because you are dynamically adding more SQL to the query based on how many I'm not sure if sqlc will support this, but I think transforming that query from a dynamic OR into a static one and using an array parameter would probably solve it. This would be an array of tuples, so I kind of have a feeling that will not be supported by SQLC :( select
system_api.id
from system_api
left join system_menu_api on (
system_menu_api.api = system_api.id
OR (system_api.url, system_api.method) = ANY(?)
)
where system_menu_api.menu = ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions