Skip to content

Proposal to improve some existing features #2672

Description

@KevenGoncalves

What do you want to change?

SQLC

Sqlc is a very good package, one of the best in go-lang world but it's lacks some features:

Dynamic query ( mainly for where, and order by)

We have some work around using when and case but it's not viable implementation and it's not documented, so the dev need to spend most of time figuring it out how to implement and in worst case you should write one more then 1 query just for the same thing, something like sqlc.where() and sqlc.orderBy() would be amazing

Slices for embed structs

Right now you only can just generate a struct not a slice of struct with slqc.embed(), would be amazing to group all structs in a slice when the id is the same for a join

Lack of functionality in sqlc.embed()

The slqc.embed() is a very good feature but have some problems: when a relation return null the queries return an error, and the sqlc.embed() doesn't support to choice which fields need to be returned from the table we want to select
something like sqlc.nembed() to allow null like sqlc.narg() would be awesome and sqlc.embed(table_1,(id, name))

Taking in consideration:
#2472
#2343
#2643

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

Activity

  1. kyleconroy commented on Oct 2, 2023

    @kyleconroy
    Collaborator

    Appreciate the feature requests.

    For dynamic query support, please follow along on #2061 and #2060.

    Grouping all embedded structs into a slice is currently beyond what we intended when designing sqlc.slice. Follow #2794 and #2760 for future workarounds.

  2. kyleconroy commented on Oct 2, 2023

    @kyleconroy
    Collaborator

    Actually tracking JSON here #2761

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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