Skip to content

Move generated parameter to function outside of struct #4193

@gebes

Description

@gebes

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

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