Skip to content

Go Param Names in Complex Statements #189

Closed
@joshuarubin

Description

@joshuarubin

I've got a query that looks something like this (though there are multiple columns being set):

-- name: UpdateFoo :one
UPDATE foo
SET
  bar = CASE WHEN $1::bool
    THEN $2::bar_type
    ELSE bar
    END
RETURNING *;

This produces a params struct like this:

type UpdateFooParams struct {
	Column1         bool           `json:""`
	Column2_2       bar_type       `json:"_2"`
}

The naming here isn't very helpful. Do you have any suggestions on how this can be improved? Either by using a different kind of query (that allows updating multiple fields, each one optional) or by somehow annotating things such that the params struct uses more helpful naming?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions