Skip to content

Commit

Permalink
sqlc: add support for 'sql_driver' go gen option
Browse files Browse the repository at this point in the history
sqlc lacks documentation on sql_driver setting
however setting is referenced in multiple places in their documentation
the inputs and validation was done based on the latest sqlc code v1.27.0
  • Loading branch information
YvanDaSilva committed Sep 5, 2024
1 parent 5ef10e8 commit 9a30b43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sqlc/kcl.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "sqlc"
edition = "v0.9.0"
version = "0.0.3"
version = "0.0.4"
description = "sqlc.dev schema config file"
4 changes: 4 additions & 0 deletions sqlc/sqlc.k
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ schema GoGen:
# Either `pgx/v4`, `pgx/v5` or `database/sql`.
# Defaults to database/sql.
sql_package: "database/sql" | "pgx/v4" | "pgx/v5" = "database/sql"
# One of the following drivers are allowed, the default value will depend on the sql_package
# and is handled by sqlc behavior:
# "github.com/jackc/pgx/v4" | "github.com/jackc/pgx/v5" | "github.com/lib/pq" | "github.com/go-sql-driver/mysql"
sql_driver?: "github.com/jackc/pgx/v4" | "github.com/jackc/pgx/v5" | "github.com/lib/pq" | "github.com/go-sql-driver/mysql"
# If true, add DB tags to generated structs. Defaults to false.
emit_db_tags: bool = False
# If true, include support for prepared queries. Defaults to false.
Expand Down
1 change: 1 addition & 0 deletions sqlc/sqlc_test.k
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ sql:
out: "some/path"
omit_unused_structs: true
emit_sql_as_comment: true
sql_driver: "github.com/go-sql-driver/mysql"
- name: "test_two"
schema: "schema.sql"
queries: "query.sql"
Expand Down

0 comments on commit 9a30b43

Please sign in to comment.