Skip to content

feat(compiler): Improve type inference for parameters compared to constants only #2742

Open
@orisano

Description

@orisano

What do you want to change?

We would like to improve the type inference of parameters compared to constants only.
Currently, it is absolutely inferred that interface{}.

https://play.sqlc.dev/p/9ba65e1196da80daf0543327f12974275bf7d83b6ae5ce32a0c0f75034d2528d

query:

-- name: Many :many
SELECT id FROM foo WHERE @param = 'foo';

generated:

func (q *Queries) Many(ctx context.Context, param interface{}) ([]int64, error) {

What type of param should be inferred, sql.NullString or string?

What database engines need to be changed?

PostgreSQL, MySQL, SQLite

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions