-
Notifications
You must be signed in to change notification settings - Fork 213
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
Scan into embedded structs #160
Comments
Thank you for the feature request! If you want to open a PR adding the functionality go for it! If you don't open a PR I'll take a look at how sqlx handles this. |
@JeremyCraven just added this in #171 let me know what you think and I'll merge. |
Released as |
As I see it doesn't support nullable embedded structs, that can be receiver using |
The notification must have slipped through awhile back, but this is definitely being leveraged. Thank you. |
So do you plan to implement it? |
Is your feature request related to a problem? Please describe.
Being able to use the built in goqu functionality like ScanStructContext and ScanStructsContext is great and makes for concise, readable code. However, I have not yet found a way to scan into a struct that has embedded structs within it.
Describe the solution you'd like
A simple example of something we would like to be able to do with goqu below.
Let's say there are two tables (table1 and table2) and we write a query to join these tables and select all columns from both the tables. I want to scan into a struct that looks like this rows struct that contains structs that define all the columns for table1 and table 2.
The query would look roughly like this.
Describe alternatives you've considered
Right now I can accomplish this by using the ToSQL() method on my query and then executing the query with sqlx because the sqlx StructScan method supports scanning into nested structs.
Dialect
Additional context
This is for sure a nice to have in goqu as it is not blocking functionality at the moment, but could help clean up a lot of code by using only goqu to accomplish these queries.
The text was updated successfully, but these errors were encountered: