-
Notifications
You must be signed in to change notification settings - Fork 978
Closed
Labels
📚 postgresql💻 linux🔧 golangbugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
Description
Version
1.15.0
What happened?
I use https://github.com/golang-migrate/migrate to create database migrations and sqlc to compile query into go code.
Here is my folder structure:
- db
- dbutils // the generated go code from sqlc
- migrations // migration files from golang-migrate
- queries // sql query for sqlc to generate
- go.mod
- go.sum
- main.go
- sqlc.yamlCurrently there is only 1 migration file inside db/migrations and 1 sql file inside db/queries. When I run sqlc generate, it succeed without error. However the generated db/dbutils/db.go contains highlighted error: cannot use tx (variable of type *sql.Tx) as DBTX value in struct literal: wrong type for method ExecContext
Relevant log output
No response
Database schema
CREATE TABLE IF NOT EXISTS review (
id SERIAL PRIMARY KEY,
url varchar NOT NULL,
title varchar(512) NOT NULL,
difficulty varchar(10) NOT NULL,
due_date timestamptz NOT NULL,
notes text,
active boolean DEFAULT true,
date_created timestamptz DEFAULT CURRENT_TIMESTAMP,
date_updated timestamptz DEFAULT CURRENT_TIMESTAMP
);SQL queries
-- name: GetReview :one
SELECT * FROM review
WHERE id = $1 LIMIT 1;
-- name: ListReviews :many
SELECT * FROM review
ORDER BY due_date ASC;
-- name: CreateReview :one
INSERT INTO review (
url, title, difficulty, due_date, notes
) VALUES (
$1, $2, $3, $4, $5
)
RETURNING *;
-- name: DeleteReview :exec
DELETE FROM review
WHERE id = $1;Configuration
version: "1"
packages:
- path: "db/dbutils"
name: "dbutils"
engine: "postgresql"
schema: "db/migrations"
queries: "db/queries"
emit_json_tags: true
emit_prepared_queries: false
emit_interface: false
emit_exact_table_names: falsePlayground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
📚 postgresql💻 linux🔧 golangbugSomething isn't workingSomething isn't workingquestionFurther information is requestedFurther information is requested
