Are there examples how to use mods with generated code? #21
-
Hello, I am trying to use the generated code but I cannot make it work with an userMod := models.SelectWhere.Users
cs, err := models.Users(ctx, c,
sm.Where(
psql.Or(userMod.ID.EQ(users[0].ID),
userMod.Email.EQ("[email protected]"),
),
),
).All() it generates the following query
note the extra |
Beta Was this translation helpful? Give feedback.
Answered by
stephenafamo
Mar 11, 2023
Replies: 2 comments 3 replies
-
This definitely looks like a bug. I'll investigate |
Beta Was this translation helpful? Give feedback.
0 replies
-
Your query should be built like this instead: _, err := models.Users(ctx, db,
sm.Where(psql.Or(
models.UserColumns.ID.EQ(psql.Arg(users[0].ID)),
models.UserColumns.Email.EQ(psql.Arg("[email protected]")),
)),
).All() Which provides the expected query
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
isgj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SelectWhere
contains mods which are supposed to be passed directly to the query builder.psql.Or
takes expressionsYour query should be built like this instead:
Which provides the expected query