-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cmd/vet): Add built-in db-prepare rule (#2396)
* feat(cmd/vet): Add built-in db-prepare rule Instead of always preparing a query when running vet, opt-in to doing it with the `db-prepare` rule. * Error if db-prepare is used when a database connection isn't available * namespace db-prepare
- Loading branch information
1 parent
a0d5d93
commit 6fd9950
Showing
8 changed files
with
102 additions
and
60 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
version: '2' | ||
sql: | ||
- schema: postgresql/schema.sql | ||
queries: postgresql/query.sql | ||
engine: postgresql | ||
database: | ||
url: postgresql://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/authors | ||
rules: | ||
- sqlc/db-prepare | ||
gen: | ||
go: | ||
package: authors | ||
out: postgresql | ||
- schema: mysql/schema.sql | ||
queries: mysql/query.sql | ||
engine: mysql | ||
database: | ||
url: root:${MYSQL_ROOT_PASSWORD}@tcp(${MYSQL_HOST}:${MYSQL_PORT})/authors?multiStatements=true&parseTime=true | ||
rules: | ||
- sqlc/db-prepare | ||
gen: | ||
go: | ||
package: authors | ||
out: mysql | ||
- schema: sqlite/schema.sql | ||
queries: sqlite/query.sql | ||
engine: sqlite | ||
database: | ||
url: file:authors?mode=memory&cache=shared | ||
rules: | ||
- sqlc/db-prepare | ||
gen: | ||
go: | ||
package: authors | ||
out: sqlite |
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
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
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
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
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
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