Skip to content

Commit 5f8cc6a

Browse files
authored
Merge pull request #342 from mbezhanov/update-docs
Document `driver_name` configuration option
2 parents 0213e2b + 6393f6b commit 5f8cc6a

File tree

2 files changed

+46
-20
lines changed

2 files changed

+46
-20
lines changed

website/docs/code-generation/psql.md

+25-11
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,31 @@ PSQL_DSN="postgres://user:pass@host:port/dbname?sslmode=disable"
4545

4646
The values that exist for the drivers:
4747

48-
| Name | Description | Default |
49-
|---------------|---------------------------------------|--------------------------|
50-
| dsn | URL to connect to | |
51-
| schemas | Schemas find tables in | ["public"] |
52-
| shared_schema | Schema to not include prefix in model | first value in "schemas" |
53-
| output | Folder for generated files | "models" |
54-
| pkgname | Package name for generated code | "models" |
55-
| uuid_pkg | UUID package to use (gofrs or google) | "gofrs" |
56-
| concurrency | How many tables to fetch in parallel | 10 |
57-
| only | Only generate these | |
58-
| except | Skip generation for these | |
48+
| Name | Description | Default |
49+
|---------------|---------------------------------------------------|--------------------------|
50+
| dsn | URL to connect to | |
51+
| driver_name | Driver to use for generating driver-specific code | `github.com/lib/pq` |
52+
| schemas | Schemas find tables in | ["public"] |
53+
| shared_schema | Schema to not include prefix in model | first value in "schemas" |
54+
| output | Folder for generated files | "models" |
55+
| pkgname | Package name for generated code | "models" |
56+
| uuid_pkg | UUID package to use (gofrs or google) | "gofrs" |
57+
| concurrency | How many tables to fetch in parallel | 10 |
58+
| only | Only generate these | |
59+
| except | Skip generation for these | |
60+
61+
## Driver-specific code
62+
63+
The `driver_name` configuration option enables Bob to generate code that is tailored to the specifics of the selected `database/sql` driver.
64+
65+
For Postgres, the supported drivers are:
66+
67+
- [github.com/lib/pq](https://pkg.go.dev/github.com/lib/pq) (default)
68+
- [github.com/jackc/pgx](https://pkg.go.dev/github.com/jackc/pgx)
69+
- [github.com/jackc/pgx/v4](https://pkg.go.dev/github.com/jackc/pgx/v4)
70+
- [github.com/jackc/pgx/v5](https://pkg.go.dev/github.com/jackc/pgx/v5)
71+
72+
Bob leverages driver-specific code to perform precise error matching for [generated error constants](./usage#generated-error-constants).
5973

6074
## Only/Except:
6175

website/docs/code-generation/sqlite.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,27 @@ SQLITE_DSN="file.db"
3939

4040
The values that exist for the drivers:
4141

42-
| Name | Description | Default |
43-
|---------------|------------------------------------------|---------------------|
44-
| dsn | Path to database | |
45-
| attach | Schemas to attach and the path to the db | map[string]string{} |
46-
| shared_schema | Schema to not include prefix in model | "main" |
47-
| output | Folder for generated files | "models" |
48-
| pkgname | Package name for generated code | "models" |
49-
| only | Only generate these | |
50-
| except | Skip generation for these | |
42+
| Name | Description | Default |
43+
|---------------|---------------------------------------------------|-----------------------|
44+
| dsn | Path to database | |
45+
| driver_name | Driver to use for generating driver-specific code | `modernc.org/sqlite` |
46+
| attach | Schemas to attach and the path to the db | map[string]string{} |
47+
| shared_schema | Schema to not include prefix in model | "main" |
48+
| output | Folder for generated files | "models" |
49+
| pkgname | Package name for generated code | "models" |
50+
| only | Only generate these | |
51+
| except | Skip generation for these | |
52+
53+
## Driver-specific code
54+
55+
The `driver_name` configuration option enables Bob to generate code that is tailored to the specifics of the selected `database/sql` driver.
56+
57+
For SQLite, the supported drivers are:
58+
59+
- [modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite) (default)
60+
- [github.com/mattn/go-sqlite3](https://pkg.go.dev/github.com/mattn/go-sqlite3)
61+
62+
Bob leverages driver-specific code to perform precise error matching for [generated error constants](./usage#generated-error-constants).
5163

5264
## Only/Except:
5365

0 commit comments

Comments
 (0)