Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion about `Queryable` docs regarding struct field order #1472
Comments
This comment has been minimized.
No. It is assuming it matches the order of the items in the select clause of the query being run. If you haven't specified a select clause, it will be all columns on the table, in the order they appear in the
Correct. If you are using |
sgrif
closed this
Jan 11, 2018
This comment has been minimized.
jonathanstrong
commented
Jan 11, 2018
|
Wow, ok. Fwiw, as a user of |
This comment has been minimized.
|
If you have any concrete places that you think it should be mentioned, feel free to open a PR. We mention in as many places as we can. |
jonathanstrong commentedJan 10, 2018
I was hoping to clarify something from the documentation of
Queryableregarding struct field order:The docs say:
(Empahsis mine.)
Is
Queryableassuming the order of the struct fields matches the order of the database columns?Lets say for an example table:
And the struct is:
My assumption had been that diesel was mapping the fields of the struct by name to the database columns. Are the docs saying that instead the struct field order is used to map to columns, such that in the example above database column "a" would map to struct field "c"?
If not, can you further explain what the docs are trying to convey?