-
Notifications
You must be signed in to change notification settings - Fork 13
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
failed to assign all query results to <type> slice #19
Comments
What is your graphql query? |
Sorry, missed it
|
I don't seem to have this problem here:
where:{
flowBlock:{
flow: {
id: {
equalTo: "flow-1"
}
}
}
} Maybe it is the StringToInterfaces function (Update: it is not the case) |
It should not be doing the |
Also this line seems to be off: queryMods = append(queryMods) we need to remove that :-D |
Is hasForeignKeyInRoot true or false? if you log it? |
Could it be that you removed the
Inside these functions?
|
Maybe when debugging #17 |
Thats current StringFilterToMods
|
|
What I get for this query
|
That should not be the case Is the if m == nil {
return nil
} In the UserWhereSubqueryToMods? func UserWhereSubqueryToMods(m *graphql_models.User, foreignColumn string) []qm.QueryMod {
if m == nil {
return nil
} |
Should not add this subquery since it's not needed since it's already filtered via your foreign key |
Yah, That's what is in, with some rubbish logging from me
|
In your userWhereToMods the func UsersWhereToMods(m *graphql_models.UserWhere, withPrimaryID bool) []qm.QueryMod {
if m == nil {
return nil
}
var queryMods []qm.QueryMod
if withPrimaryID {
fmt.Println("THIS SHOULD NOT LOG IN YOUR CASE ")
queryMods = append(queryMods, IDFilterToMods(m.ID, models.BlockColumns.ID)...)
}
.................. |
Ok in my case it runs too I see now xD. Looking into it further |
Ok, it runs only when for the root. I do not get any subqueries back |
I dit put the log in te wrong place. So still can not reproduce it :) |
In my example this log never runs it's the same as yours relationship wise. func FlowWhereToMods(m *graphql_models.FlowWhere, withPrimaryID bool) []qm.QueryMod {
if m == nil {
return nil
}
var queryMods []qm.QueryMod
if withPrimaryID {
fmt.Println("FlowWhereToMods withPrimaryID == true")
queryMods = append(queryMods, IDFilterToMods(m.ID, models.FlowColumns.ID)...)
} |
In my case
|
Somehow the UserWhereToMods adds a ID to the subquery but it should not since withPrimaryID should be false since it's !hasForeignKeyInRoot
|
Ok thats the problem! |
Looking into it ;) |
Thanks for all your help that's a bug in gqlgen-sqlboiler! |
Won't it break existing usage of the library for other users? |
No, it keeps working for number id's. But it's a bug with support stringId's. Number id's have different convert functions. |
We surely need some config in the future. Also for this #18. But I'll probably tag it as a v3 release since it's a breaking change more or less. |
This is really not, since it only fix this bug. Users with int id's did not have this problem, that's why I did not have the issue. |
I see, makes sense |
v2.0.9 should work! |
I also really want to spend more time automatically testing the results so that everyone's use case continues to work properly. Also more in development branch before real releases, it's on the roadmap, but I have some tight deadlines at the moment so mostly trying it out in production right away so the basic thing should keep working just fine. The string id's are another use-case for which there is a reason to make automatic tests because they are not used internally and can therefore be broken more easily. I'm thinking in automatic test as in integration test which test the whole flow gqlgen -> gqlgen-sqlboiler -> boiler. which will result in resolver_test.go files if you choose to opt-in for that so you have a lot of testing coverage out of the box. |
It does work indeed! Thanks |
Thanks. Also updated the examples! |
For the following schema and generated query mods, sqlboiler returns an error
If comment
subQueryMods := UserWhereToMods(m, !hasForeignKeyInRoot)
part from function below it seem to start workingThe text was updated successfully, but these errors were encountered: