Skip to content

emit_exported_queries results in const and func having the same name in query.sql.go #3970

Open
@SunnysideAaron

Description

@SunnysideAaron

Version

1.29.0

What happened?

Just using the basic tutorial. pgx/v5 if it matters. Here is the generated output. Am I missing something? go doesn't allow a const and func to share the same name in the same scope.

const CreateAuthor = `-- name: CreateAuthor :one
INSERT INTO authors (
  name, bio
) VALUES (
  $1, $2
)
RETURNING id, name, bio
`

type CreateAuthorParams struct {
	Name string
	Bio  pgtype.Text
}

func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) {
	row := q.db.QueryRow(ctx, CreateAuthor, arg.Name, arg.Bio)
	var i Author
	err := row.Scan(&i.ID, &i.Name, &i.Bio)
	return i, err
}

Relevant log output

Database schema

SQL queries

Configuration

Playground URL

No response

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

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