Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(postgresql): Remove extra newline with db argument (#1417)
The original fix (#1395) for #1393 did not cover the case where `emit_methods_with_db_argument` was set to `true`. This follows the same pattern to handle that case as well.
- Loading branch information
Showing
6 changed files
with
156 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/go/db.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/go/models.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/go/query.sql.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/query.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
CREATE TABLE foo ( | ||
bar text | ||
); | ||
|
||
-- name: ManyFoo :many | ||
-- This function returns a list of Foos | ||
SELECT * FROM foo; | ||
|
||
-- name: OneFoo :one | ||
-- This function returns one Foo | ||
SELECT * FROM foo; | ||
|
||
-- name: ExecFoo :exec | ||
-- This function creates a Foo via :exec | ||
INSERT INTO foo (bar) VALUES ("bar"); | ||
|
||
-- name: ExecRowFoo :execrows | ||
-- This function creates a Foo via :execrows | ||
INSERT INTO foo (bar) VALUES ("bar"); | ||
|
||
-- name: ExecResultFoo :execresult | ||
-- This function creates a Foo via :execresult | ||
INSERT INTO foo (bar) VALUES ("bar"); |
14 changes: 14 additions & 0 deletions
14
internal/endtoend/testdata/comment_godoc_db_argument/postgresql/pgx/sqlc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"version": "1", | ||
"packages": [ | ||
{ | ||
"path": "go", | ||
"name": "querytest", | ||
"engine": "postgresql", | ||
"schema": "query.sql", | ||
"queries": "query.sql", | ||
"sql_package": "pgx/v4", | ||
"emit_methods_with_db_argument": true | ||
} | ||
] | ||
} |