55` sqlc vet ` runs queries through a set of lint rules.
66
77Rules 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
1616message Config
@@ -33,18 +33,17 @@ message Query
3333 repeated Parameter params = 4;
3434}
3535
36-
3736message 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
4847rules you can write.
4948
5049``` yaml
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
9392version: 2
108107To see this in action, check out the [authors
109108example](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`.
0 commit comments