Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SunnysideAaron opened this issue May 19, 2025 · 0 comments
Labels
bug Something isn't working 🔧 golang

Comments

@SunnysideAaron
Copy link

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

@SunnysideAaron SunnysideAaron added the bug Something isn't working label May 19, 2025
@dosubot dosubot bot added the 🔧 golang label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🔧 golang
Projects
None yet
Development

No branches or pull requests

1 participant