-
Notifications
You must be signed in to change notification settings - Fork 978
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingtriageNew issues that hasn't been reviewedNew issues that hasn't been reviewed
Description
Version
1.12.0
What happened?
In the generated function, there is a Go error. id redeclared in this block
There are two id variables. One in the function parameter and another in the function body.
Relevant log output
const getUserRole = `-- name: GetUserRole :one
SELECT id FROM public.user_roles
WHERE id = $1 LIMIT 1
`
func (q *Queries) GetUserRole(ctx context.Context, id int64) (int64, error) {
row := q.db.QueryRow(ctx, getUserRole, id)
var id int64
err := row.Scan(&id)
return id, err
}Database schema
CREATE TABLE user_roles (
id BIGSERIAL PRIMARY KEY
);SQL queries
-- name: GetUserRole :one
SELECT * FROM public.user_roles
WHERE id = $1 LIMIT 1;Configuration
version: "2"
sql:
- schema: "server/database/postgres/migrate/"
queries: "server/database/postgres/sqlc_queries/user/"
engine: "postgresql"
gen:
go:
package: "user"
out: "server/go/layer/repository/db/pgsql/user"
sql_package: "pgx/v4"Playground URL
No response
What operating system are you using?
Windows
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageNew issues that hasn't been reviewedNew issues that hasn't been reviewed