Skip to content

Add emit_result_struct_pointers and emit_params_struct_pointers options #979

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

Merged
merged 10 commits into from
Sep 20, 2021

Conversation

dchertkov
Copy link
Contributor

Add emit_result_struct_pointers and emit_params_struct_pointers options for Go generator.

This is second attempt at improvement as noted here #812

@jwilner
Copy link
Contributor

jwilner commented Apr 26, 2021

Would love to see this landed soon! It'd make the generated types much more idiomatic: https://github.com/golang/go/wiki/CodeReviewComments#receiver-type

@jwilner
Copy link
Contributor

jwilner commented May 12, 2021

@kyleconroy anything we can do to help get this merged? Using pointer types would be a lot more idiomatic imo.

@kyleconroy
Copy link
Collaborator

@dchertkov I'm so sorry reviewing this pull request fell through the cracks. If you're willing to fix the merge conflicts and update to the latest code, I can promise to review it as soon as it's ready. Let me know.

@dchertkov
Copy link
Contributor Author

@kyleconroy All is ready.

Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this approach looks good. A few things to clean up before we can get this merged.

SELECT a, b FROM foo
`

func (q *Queries) GetAll(ctx context.Context) ([]*Foo, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The slice of structs seems weird to me, but I guess that's what you'd want in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update the docs with the new configuration options, but that can be done in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants