You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: move cancellation docs into docs/03_Usage.md so they survive README regeneration (#430)
The cancellation documentation (withCancellationToken option and Cancellation
section) was added directly to README.md in PR #420. However, README.md is
auto-generated by concatenating docs/0*.md files via generate_all_docs.sh.
When the release prep workflow regenerates the README, the cancellation
content gets lost because it lives only in README.md itself.
Fix: move the content into docs/03_Usage.md (the Usage doc where the options
table and transactions section live), then regenerate README.md from the docs.
Copy file name to clipboardExpand all lines: README.md
+31-8Lines changed: 31 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ sql:
51
51
| Override | values: A nested override value like [this](#override-option). | Yes | Allows you to override the generated C# data types for specific columns in specific queries. This option accepts a `query_name:column_name` mapping and the overriden data type. | |
52
52
| useCentralPackageManagement | default: `false`<br/>values: `false`,`true` | Yes | If true, the code is generated to support central package management. |
53
53
| withAsyncSuffix | default: `true`<br/>values: `false`,`true` | Yes | When true, async methods will have the "Async" suffix appended to their names (e.g., `GetAuthorAsync`). When false, async methods will not have the suffix (e.g., `GetAuthor`). |
54
-
| withCancellationToken | default: `false`<br/>values: `false`,`true` | Yes | When true, every generated method takes an optional trailing `CancellationToken cancellationToken = default`, threaded into every async DB call so in-flight queries can be cancelled. See [Cancellation](#cancellation). When false (default), generated output is unchanged. |
54
+
| withCancellationToken | default: `false`<br/>values: `false`,`true` | Yes | When true, every generated method takes an optional trailing `CancellationToken cancellationToken = default`, threaded into every async DB call so in-flight queries can be cancelled. See [Cancellation](#cancellation). When false (default), generated output is unchanged. |
55
55
56
56
### Override option
57
57
Override for a specific query:
@@ -255,6 +255,8 @@ we consider support for the different data types separately for batch inserts an
255
255
| jsonpath | ✅ | ⚠️ |
256
256
| xml | ✅ | ⚠️ |
257
257
| enum | ✅ | ⚠️ |
258
+
| any | ✅ | ❌ |
259
+
| hstore | ✅ | ❌ |
258
260
259
261
*** `time with time zone` is not useful and not recommended to use by Postgres themselves -
260
262
see [here](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME) -
@@ -272,6 +274,9 @@ An example of this conversion:
272
274
INSERT INTO tab1 (macaddr8_field) VALUES (sqlc.narg('macaddr8_field')::macaddr8);
273
275
```
274
276
277
+
*** `any` is a pseudo-type reported by sqlc when it cannot infer a column's type; it maps to `object` in C#.
278
+
*** `hstore` is a key-value store type that maps to `object` in C#; readers use `GetValue()` to retrieve the value.
279
+
275
280
</details>
276
281
277
282
# MySQL
@@ -473,16 +478,34 @@ make test-wasm-plugin
473
478
```
474
479
475
480
## Release flow
481
+
476
482
The release flow in this repo follows the semver conventions, building tag as `v[major].[minor].[patch]`.
477
-
In order to create a release you need to add `[release]` somewhere in your commit message when merging to master.
478
483
479
-
### Version bumping (built on tags)
480
-
By default, the release script will bump the patch version. Adding `[release]` to your commit message results in a new tag with `v[major].[minor].[patch]+1`.
481
-
- Bump `minor` version by adding `[minor]` to your commit message resulting in a new tag with `v[major].[minor]+1.0` <br/>
482
-
- Bump `major` version by adding `[major]` to your commit message resulting in a new tag with `v[major]+1.0.0` <br/>
484
+
### PR Gate
485
+
486
+
Every PR that modifies source code, build configuration, or similar must be labeled with one of: `major`, `minor`, `patch`, or `skip-release`.
487
+
488
+
A bot posts a status check (`release-assistant/requirements`) that blocks merging until a version label is present.
489
+
490
+
### Generate Release PR
491
+
492
+
When Build completes on `main`, the `gen-release-pr.yml` workflow runs and:
493
+
494
+
1. Aggregates all unreleased, labeled PRs since the last release tag.
495
+
2. Determines the release type from the labels (`major` > `minor` > `patch`).
496
+
3. Computes the new version from the latest tag.
497
+
4. Downloads the latest wasm artifact and computes its sha256.
498
+
5. Regenerates documentation (README, quickstart) with the new version and wasm sha.
499
+
6. Opens a `release-prep` PR with the regenerated docs.
500
+
501
+
### Release
502
+
503
+
When the `release-prep` PR is merged, `release.yml`:
483
504
484
-
### Release structure
485
-
The new created tag will create a draft release with it, in the release there will be the wasm plugin embedded in the release. <br/>
505
+
1. Detects the `chore: prepare release vX` commit.
506
+
2. Downloads the wasm artifact from the triggering Build.
507
+
3. Reconstructs release notes from merged PR titles since the previous tag.
508
+
4. Creates the release (with tag) and uploads the wasm asset.
Copy file name to clipboardExpand all lines: docs/03_Usage.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
| Override | values: A nested override value like [this](#override-option). | Yes | Allows you to override the generated C# data types for specific columns in specific queries. This option accepts a `query_name:column_name` mapping and the overriden data type. ||
13
13
| useCentralPackageManagement | default: `false`<br/>values: `false`,`true`| Yes | If true, the code is generated to support central package management. |
14
14
| withAsyncSuffix | default: `true`<br/>values: `false`,`true`| Yes | When true, async methods will have the "Async" suffix appended to their names (e.g., `GetAuthorAsync`). When false, async methods will not have the suffix (e.g., `GetAuthor`). |
15
+
| withCancellationToken | default: `false`<br/>values: `false`,`true`| Yes | When true, every generated method takes an optional trailing `CancellationToken cancellationToken = default`, threaded into every async DB call so in-flight queries can be cancelled. See [Cancellation](#cancellation). When false (default), generated output is unchanged. |
15
16
16
17
### Override option
17
18
Override for a specific query:
@@ -118,3 +119,31 @@ public async Task ExampleTransaction(IDbConnection connection)
118
119
```
119
120
120
121
More info can be found in [here](https://docs.sqlc.dev/en/stable/howto/transactions.html).
122
+
123
+
### Cancellation
124
+
Set `withCancellationToken: true` to make every generated method accept an optional
125
+
`CancellationToken`. The token is threaded into every async database call, so a cancelled
126
+
token interrupts the in-flight query and releases the locks that statement holds. The
127
+
option is off by default; when off, generated output is identical to before.
128
+
129
+
```C#
130
+
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
131
+
try
132
+
{
133
+
var author = await queries.GetAuthor(authorId, cts.Token);
134
+
}
135
+
catch (OperationCanceledException)
136
+
{
137
+
// the query was cancelled; its statement-level locks are released
138
+
}
139
+
```
140
+
141
+
Notes:
142
+
- **PostgreSQL & MySQL** interrupt the running statement server-side (Npgsql sends a cancel
143
+
request; MySqlConnector issues `KILL QUERY`), releasing that statement's locks immediately.
144
+
- **SQLite** runs synchronously and only honours the token *before* the statement starts;
145
+
an already-running SQLite statement is not interrupted.
146
+
- **Transactions:** cancelling a query inside a `WithTransaction(...)` flow releases only that
147
+
statement's locks. Locks held by earlier statements in the transaction (and, on PostgreSQL,
148
+
the aborted-transaction state) are released when **you** roll back — the generated code never
0 commit comments