Closed
Description
The docs have this example:
CREATE TABLE authors (
id SERIAL PRIMARY KEY,
bio text NOT NULL
);
-- name: UpdateAuthor :exec
UPDATE authors SET bio = $2
WHERE id = $1;
Which is documented as generating the following function with positional parameters:
func (q *Queries) UpdateAuthor(ctx context.Context, id int, bio string) error {
_, err := q.db.ExecContext(ctx, updateAuthor, id, bio)
return err
}
However the latest version of sqlc (v1.12.0) generates this:
type UpdateAuthorParams struct {
ID int32
Bio string
}
func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error {
_, err := q.db.ExecContext(ctx, updateAuthor, arg.ID, arg.Bio)
return err
}
Is this just a matter of outdated docs, or am I missing something? I prefer positional parameters in cases where there are 1-3 args; is there currently a way to get one vs. the other?
Thank you for this useful and satisfying project. ❤️