sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Move generated parameter to function outside of struct

Open gebes opened this issue 4 weeks ago • 0 comments

What do you want to change?

When I write this query

-- name: Update :one
UPDATE "user"
SET
    firstname = $2,
    surname = $3
WHERE id = $1
RETURNING *;

I get this function

func (q *Queries) Update(ctx context.Context, arg UpdateParams) (*model.User, error) {

Is there any way to move the ID out of the Update Params? E.g. Update(ctx, id, arg), maybe make it definable using a macro in the sql query?

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

gebes avatar Nov 23 '25 12:11 gebes