-
Notifications
You must be signed in to change notification settings - Fork 48
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
Table mapped structs do not support embedded structs #13
Comments
Looking a bit deeper, it seems that we are not making as much use of TableMap as we could, chiefly in Get. But I wonder if we could aslo could maintain a set of 'TableMaps' (or an improved 'QueryMap') for all queries, possibly indexed by the query string or prepared statement. |
It looks like I'm going to have to create a |
Okay let me know if there is any independent work that I could help with. I like the idea of extending/improving TableMap to shift as much computation/reflection to mapping time rather than query time. I'd also like to bind arbitrary non-table queries. Any thoughts on that? |
Any update on this? I would be interested in adding support for embedded structs to modl, as I did for gorp. I'm happy to help you finish/test it if you've already begun on the |
FWIW, I implemented support for embedded structs in https://github.com/sqs/modl/commit/e801ca1fef9784285e9a36cde3a01f7287c85f69. If you would like to use this implementation instead of refactoring and creating |
Please do, I'll almost certainly have time to look it over at Gophercon. |
Just sounding off, embedded structures would be great to have! |
Likewise, I'd also like to see support for embedded structs. |
I'm also very interested in this feature. Is there any way we can help, or is it dependent on new reflectx features? |
Any news? Thanks! |
I'm interested in this as well. Any updates? |
Any update here? We are also struggling with this. |
It seams that this repo is not maintained any more. We also moved to @sqs 10 days ago. |
FYI, we (@sourcegraph) just moved to go-gorp/gorp as we are not using embedded structs anymore. The @sqs fork has worked well for us, but I don't plan on maintaining it.
|
If I attempt to map:
With:
It will fail with
sql: converting Exec argument #2's type: unsupported type models.CreatedUpdated, a struct
This is because the embedded struct walking logic in
dbmap.AddTable
was removed with the intention to let sqlx handle the scanning.Somehow we need to extract the logic in
sqlx.StructScan
and use it here, or if it does not generalise well add back in support for struct scanning in modl.It also appears much of the bindPlan functionality from gorp has been abandoned, it would be nice to use prepared statements in the bind plan and also use the table mapping to remove as much reflection as possible when running a query. Since we have mapped the table up front I feel we should be able to use something leaner than
sqlx.StructScan
in Get or other planned queries...The text was updated successfully, but these errors were encountered: