Skip to content

Configure positional parameter logic #1498

Closed
@kyleconroy

Description

@kyleconroy

What do you want to change?

For Go, sqlc will use a positional argument for a query if there's a single parameter. If there's more than one, it will generate a parameters struct. While this works for me, a few other folks would like different behavior.

@brentd would like to use positional arguments for up to three parameters (#1496)
@Threpio would like to always use parameter structs (#1373)

How should we do it?

We can solve this using a single configuration parameter called query_parameter_limit, which defaults to 1 (the current behavior). We can set the value to a pointer in the configuration YAML / JSON so that zero is a valid option. Anything less than zero should be an error.

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions