Skip to content

Use interfaces as query inputs instead of structs #3067

Open
@roozbehsayadi

Description

@roozbehsayadi

What do you want to change?

Hi!
I run into a little issue every time I use SQLC (which is a lot btw).
I sometimes need to use auto-generated queries to work with the data I currently have, but it doesn't work since the input of query is a struct and Go cannot automatically convert structs to each other.
All the data I need for query is available in my struct (sometimes with the exact same name!) but I can't use it, and I have to convert it to the desired struct.
But, if we use interfaces as inputs to queries, we will no longer need to do this. We become able to use similar structs instead of each other.
I think it would make a nice change in how much boilerplate code we produce while using this tool.

Thanks! I would love to hear your opinions on this.

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions