-
Notifications
You must be signed in to change notification settings - Fork 49
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
Errors in generated code that implements relationship defined in config. #284
Comments
Sorry, forgot to mention this is using Postgres, and |
See if the above PR fixes the issue @trentclowater |
@stephenafamo This fixes the first error with the
are still present. |
You are the one to fix this. To represent the string, you have to quote it appropriately in the configuration The
I'll look into this |
Also, can you share a minimal schema I can use to reproduce this? |
I can probably share a minimal schema in a day or two. Will get back to you. For the |
New fixes in #286. Try it out and let me know. |
Yes, this fixes the issue. The generated code is now correct. Thanks! |
I have added a relationship in the config file, but it seems to be generating invalid code.
The relationship:
This generates the following code in
models/organization_user_roles.go
:The line
causes the error
cannot use sm.Where(ResourceRoleColumns.ResourceType.EQ(psql.Arg("users"))) (value of type mods.Where[*dialect.SelectQuery]) as bob.Expression value in argument to sm.InnerJoin(ResourceRoles.NameAs(ctx)).On: mods.Where[*dialect.SelectQuery] does not implement bob.Expression (missing method WriteSQL)
.It looks like this line should be:
Also in the same file, this code is generated:
This causes the error
undefined: users
. In this case, it looks like the line:should be:
since
ResourceType
is anomit.Val[string]
.There is also a similar problem in
models/users.go
in another generated function:And also in that same file, there is also this:
which causes the error
undefined: err
in the line:If I manually correct those errors in the generated code, it seems to work as expected.
The text was updated successfully, but these errors were encountered: