Skip to content

Commit 14b119b

Browse files
docs: some v1.19.0 release copyediting (#2409)
* docs: some v1.19.0 release copyediting * Update changelog.md --------- Co-authored-by: Kyle Conroy <[email protected]>
1 parent 7ca892f commit 14b119b

File tree

4 files changed

+53
-47
lines changed

4 files changed

+53
-47
lines changed

docs/howto/ci-cd.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
# Suggested CI/CD setup
1+
# Using sqlc in CI/CD
22

33
If your project has more than a single developer, we suggest running `sqlc` as
4-
part of your CI/CD pipeline. The two commands you'll want to run are `diff` and `vet`
4+
part of your CI/CD pipeline. The two subcommands you'll want to run are `diff` and `vet`.
55

6-
`sqlc diff` ensures that code is up to date. New developers to a project may
7-
forget to run `sqlc generate`. They also might edit generated code. `diff` will
8-
catch both scenarios.
6+
`sqlc diff` ensures that your generated code is up to date. New developers to a project may
7+
forget to run `sqlc generate` after adding a query or updating a schema. They also might
8+
edit generated code. `sqlc diff` will catch both errors by comparing the expected output
9+
from `sqlc generate` to what's on disk.
910

1011
```diff
11-
% sqlc-dev diff
12+
% sqlc diff
1213
--- a/postgresql/query.sql.go
1314
+++ b/postgresql/query.sql.go
1415
@@ -55,7 +55,7 @@
@@ -20,16 +21,16 @@ catch both scenarios.
2021
`
2122
```
2223

23-
`sqlc vet` runs a set of lint checks against your SQL queries. These checks are
24+
`sqlc vet` runs a set of lint rules against your SQL queries. These rules are
2425
helpful in catching anti-patterns before they make it into production. Please
25-
see the [vet](vet.md) documentation for a complete guide on adding checks to your
26-
project.
26+
see the [vet](vet.md) documentation for a complete guide to adding lint rules
27+
for your project.
2728

2829
## General setup
2930

3031
Install `sqlc` using the [suggested instructions](../overview/install).
3132

32-
Create two steps in your pipelines, one for `sqlc diff`and one for `sqlc vet`.
33+
Create two steps in your pipeline, one for `sqlc diff`and one for `sqlc vet`.
3334

3435
## GitHub Actions
3536

@@ -38,7 +39,9 @@ GitHub Action to install `sqlc`. The action uses the built-in
3839
[tool-cache](https://github.com/actions/toolkit/blob/main/packages/tool-cache/README.md)
3940
to speed up the installation process.
4041

41-
The following workflow runs `sqlc diff` on every push.
42+
## GitHub Workflows
43+
44+
The following GitHub Workflow configuration runs `sqlc diff` on every push.
4245

4346
```yaml
4447
name: sqlc
@@ -54,8 +57,9 @@ jobs:
5457
- run: sqlc diff
5558
```
5659
57-
We also encourage running [`sqlc vet`](vet.md). To get the most value out of
58-
`vet`, you'll want to set up a running database.
60+
The following GitHub Workflow configuration runs [`sqlc vet`](vet.md) on every push.
61+
You can use `sqlc vet` without a database connection, but you'll need one if your
62+
`sqlc` configuration references the built-in `sqlc/db-prepare` lint rule.
5963

6064
```yaml
6165
name: sqlc

docs/howto/vet.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
`sqlc vet` runs queries through a set of lint rules.
66

77
Rules are defined in the `sqlc` [configuration](../reference/config) file. They consist
8-
of a name, message, and an expression. If the expression evaluates to `true`, an
9-
error is reported. These expressions are evaluated using
10-
[cel-go](https://github.com/google/cel-go).
8+
of a name, message, and a [Common Expression Language (CEL)](https://github.com/google/cel-spec)
9+
expression. Expressions are evaluated using [cel-go](https://github.com/google/cel-go).
10+
If an expression evaluates to `true`, an error is reported using the given message.
1111

12-
Each expression has access to a query object, which is defined as the following
13-
struct:
12+
Each expression has access to variables from your sqlc configuration and queries,
13+
defined in the following struct:
1414

1515
```proto
1616
message Config
@@ -33,18 +33,17 @@ message Query
3333
repeated Parameter params = 4;
3434
}
3535
36-
3736
message Parameter
3837
{
3938
int32 number = 1;
4039
}
4140
```
4241

43-
This struct may be expanded in the future to include more query information.
44-
We may also add information from a running database, such as the result from
45-
`EXPLAIN`.
42+
This struct will likely expand in the future to include more query information.
43+
We may also add information returned from a running database, such as the result from
44+
`EXPLAIN ...`.
4645

47-
While these examples are simplistic, they give you an idea on what types of
46+
While these examples are simplistic, they give you a flavor of the types of
4847
rules you can write.
4948

5049
```yaml
@@ -85,9 +84,9 @@ rules:
8584
8685
### sqlc/db-prepare
8786
88-
When a [database](../reference/config.html#database) in configured, the `sqlc/db-preapre`
89-
rule will attempt to prepare each of your queries against the connected
90-
database. Any failures will be reported to standard error.
87+
When a [database](../reference/config.html#database) connection is configured, you can
88+
run the built-in `sqlc/db-preapre` rule. This rule will attempt to prepare
89+
each of your queries against the connected database and report any failures.
9190

9291
```yaml
9392
version: 2
@@ -108,5 +107,6 @@ sql:
108107
To see this in action, check out the [authors
109108
example](https://github.com/kyleconroy/sqlc/blob/main/examples/authors/sqlc.yaml).
110109

111-
Please note that `sqlc` does not manage or migrate the database. Use your
112-
migration tool of choice to create the necessary database tables and objects.
110+
Please note that `sqlc` does not manage or migrate your database. Use your
111+
migration tool of choice to create the necessary database tables and objects
112+
before running `sqlc vet`.

docs/reference/changelog.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ Released 2023-07-06
88

99
#### sqlc vet
1010

11-
[`vet`](../howto/vet.md) runs queries through a set of lint rules.
11+
[`sqlc vet`](../howto/vet.md) runs queries through a set of lint rules.
1212

13-
Rules are defined in the `sqlc` [configuration](config.html#rules) file. They consist
14-
of a name, message, and an expression. If the expression evaluates to `true`, an
15-
error is reported. These expressions are evaluated using
16-
[cel-go](https://github.com/google/cel-go).
13+
Rules are defined in the `sqlc` [configuration](config.md) file. They consist
14+
of a name, message, and a [Common Expression Language (CEL)](https://github.com/google/cel-spec)
15+
expression. Expressions are evaluated using [cel-go](https://github.com/google/cel-go).
16+
If an expression evaluates to `true`, an error is reported using the given message.
1717

18-
While these examples are simplistic, they give you an idea on what types of
18+
While these examples are simplistic, they give you a flavor of the types of
1919
rules you can write.
2020

2121
```yaml
@@ -55,12 +55,12 @@ rules:
5555
##### Database connectivity
5656
5757
`vet` also marks the first time that `sqlc` can connect to a live, running
58-
database server. This functionality will be expanded over time, but for now it
58+
database server. We'll expand this functionality over time, but for now it
5959
powers the `sqlc/db-prepare` built-in rule.
6060

61-
When a [database](config.html#database) in configured, the `sqlc/db-preapre`
62-
rule will attempt to prepare each of your queries against the connected
63-
database. Any failures will be reported to standard error.
61+
When a [database](config.html#database) is configured, the
62+
`sqlc/db-preapre` rule will attempt to prepare each of your
63+
queries against the connected database and report any failures.
6464

6565
```yaml
6666
version: 2
@@ -81,8 +81,9 @@ sql:
8181
To see this in action, check out the [authors
8282
example](https://github.com/kyleconroy/sqlc/blob/main/examples/authors/sqlc.yaml).
8383

84-
Please note that `sqlc` does not manage or migrate the database. Use your
85-
migration tool of choice to create the necessary database tables and objects.
84+
Please note that `sqlc` does not manage or migrate your database. Use your
85+
migration tool of choice to create the necessary database tables and objects
86+
before running `sqlc vet`.
8687

8788
#### Omit unused structs
8889

docs/reference/config.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Each mapping in the `sql` collection has the following keys:
4343
- `gen`:
4444
- A mapping to configure built-in code generators. See [gen](#gen) for the supported keys.
4545
- `database`:
46-
- A mapping configure database connections. See [database](#database) for the supported keys.
46+
- A mapping to configure database connections. See [database](#database) for the supported keys.
4747
- `rules`:
4848
- A collection of rule names to run via `sqlc vet`. See [rules](#rules) for configuration options.
4949
- `strict_function_checks`
@@ -86,11 +86,11 @@ sql:
8686
The `database` mapping supports the following keys:
8787

8888
- `uri`:
89-
- Database connection URL
89+
- Database connection URI
9090

91-
The URI can contain references to environment variables using the `${...}`
92-
syntax. In the following example, the connection string will set the value of
93-
the password to the value set in the `PG_PASSWORD` environment variable.
91+
The `uri` string can contain references to environment variables using the `${...}`
92+
syntax. In the following example, the connection string will have the value of
93+
the `PG_PASSWORD` environment variable set as its password.
9494

9595
```yaml
9696
version: '2'
@@ -344,9 +344,10 @@ Each mapping in the `rules` collection has the following keys:
344344
- `rule`:
345345
- A [Common Expression Language (CEL)](https://github.com/google/cel-spec) expression. Required.
346346
- `message`:
347-
- An optional message shown when the rule returns true.
347+
- An optional message shown when this rule evaluates to `true`.
348348

349-
See the [vet](../howto/vet.md) documentation for help writing custom rules.
349+
See the [vet](../howto/vet.md) documentation for a list of built-in rules and
350+
help writing custom rules.
350351

351352
```yaml
352353
version: 2

0 commit comments

Comments
 (0)