Skip to content

Commit b90a726

Browse files
update docs (#356)
Co-authored-by: SockworkOrange <26390445+SockworkOrange@users.noreply.github.com>
1 parent 07ba684 commit b90a726

3 files changed

Lines changed: 188 additions & 13 deletions

File tree

README.md

Lines changed: 100 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ version: "2"
1212
plugins:
1313
- name: csharp
1414
wasm:
15-
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.4/sqlc-gen-csharp.wasm
16-
sha256: ceb948980f5a49e2922824f068f812f9ac70287da6dcc8c8199c8b4ceeaec858
15+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.22.0/sqlc-gen-csharp.wasm
16+
sha256: 9de8713ddcde8f21787ed925fb65744aa04f027ea6c23320292dc31d28aab80d
1717
sql:
1818
# For PostgresSQL
1919
- schema: schema.sql
@@ -39,15 +39,18 @@ sql:
3939
```
4040
# Usage
4141
## Options
42-
| Option | Possible values | Optional | Info |
43-
|--------------------- |----------------------------------------------------------------------------------------------|----------|------|
44-
| overrideDriverVersion| default:<br/> `2.3.6` for MySqlConnector (mysql)<br/>`8.0.3` for Npgsql (postgresql)<br/>`8.0.10` for Microsoft.Data.Sqlite (sqlite)<br/><br/>values: The desired driver version | Yes | Allows you to override the version of DB driver to be used. |
45-
| targetFramework | default: `net8.0`<br/>values: `netstandard2.0`, `netstandard2.1`, `net8.0` | Yes | Determines the target framework for your generated code, meaning the generated code will be compiled to the specified runtime.<br/>For more information and help deciding on the right value, refer to the [Microsoft .NET Standard documentation](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-1-0). |
46-
| generateCsproj | default: `true`<br/>values: `false`,`true` | Yes | Assists you with the integration of SQLC and csharp by generating a `.csproj` file. This converts the generated output to a .dll, a project that you can easily incorporate into your build process. |
47-
| namespaceName | default: the generated project name | Yes | Allows you to override the namespace name to be different than the project name |
48-
| useDapper | default: `false`<br/>values: `false`,`true` | Yes | Enables Dapper as a thin wrapper for the generated code. For more information, please refer to the [Dapper documentation](https://github.com/DapperLib/Dapper). |
49-
| overrideDapperVersion| default:<br/> `2.1.35`<br/>values: The desired Dapper version | Yes | If `useDapper` is set to `true`, this option allows you to override the version of Dapper to be used. |
50-
| 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. | |
42+
43+
| Option | Possible values | Optional | Info |
44+
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
45+
| overrideDriverVersion | default:<br/> `2.3.6` for MySqlConnector (mysql)<br/>`8.0.3` for Npgsql (postgresql)<br/>`8.0.10` for Microsoft.Data.Sqlite (sqlite)<br/><br/>values: The desired driver version | Yes | Allows you to override the version of DB driver to be used. |
46+
| targetFramework | default: `net8.0`<br/>values: `netstandard2.0`, `netstandard2.1`, `net8.0` | Yes | Determines the target framework for your generated code, meaning the generated code will be compiled to the specified runtime.<br/>For more information and help deciding on the right value, refer to the [Microsoft .NET Standard documentation](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-1-0). |
47+
| generateCsproj | default: `true`<br/>values: `false`,`true` | Yes | Assists you with the integration of SQLC and csharp by generating a `.csproj` file. This converts the generated output to a .dll, a project that you can easily incorporate into your build process. |
48+
| namespaceName | default: the generated project name | Yes | Allows you to override the namespace name to be different than the project name |
49+
| useDapper | default: `false`<br/>values: `false`,`true` | Yes | Enables Dapper as a thin wrapper for the generated code. For more information, please refer to the [Dapper documentation](https://github.com/DapperLib/Dapper). |
50+
| overrideDapperVersion | default:<br/> `2.1.35`<br/>values: The desired Dapper version | Yes | If `useDapper` is set to `true`, this option allows you to override the version of Dapper to be used. |
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+
| useCentralPackageManagement | default: `false`<br/>values: `false`,`true` | Yes | If true, the code is generated to support central package management. |
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`). |
5154

5255
### Override option
5356
Override for a specific query:
@@ -428,6 +431,36 @@ By default, the release script will bump the patch version. Adding `[release]` t
428431
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/>
429432
# Examples
430433
<details>
434+
<summary>QuickStartPostgresDalGen</summary>
435+
436+
## Engine `postgresql`: [QuickStartPostgresDalGen](examples/QuickStartPostgresDalGen)
437+
### [Schema](examples/config/postgresql/authors/schema.sql) | [Queries](examples/config/postgresql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/QuickStartPostgresDalGen.cs)
438+
### Config
439+
```yaml
440+
```
441+
442+
</details>
443+
<details>
444+
<summary>QuickStartMySqlDalGen</summary>
445+
446+
## Engine `mysql`: [QuickStartMySqlDalGen](examples/QuickStartMySqlDalGen)
447+
### [Schema](examples/config/mysql/authors/schema.sql) | [Queries](examples/config/mysql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/QuickStartMySqlDalGen.cs)
448+
### Config
449+
```yaml
450+
```
451+
452+
</details>
453+
<details>
454+
<summary>QuickStartSqliteDalGen</summary>
455+
456+
## Engine `sqlite`: [QuickStartSqliteDalGen](examples/QuickStartSqliteDalGen)
457+
### [Schema](examples/config/sqlite/authors/schema.sql) | [Queries](examples/config/sqlite/authors/query.sql) | [End2End Test](end2end/EndToEndTests/QuickStartSqliteDalGen.cs)
458+
### Config
459+
```yaml
460+
```
461+
462+
</details>
463+
<details>
431464
<summary>Npgsql</summary>
432465

433466
## Engine `postgresql`: [NpgsqlExample](examples/NpgsqlExample)
@@ -471,6 +504,10 @@ overrides:
471504
csharp_type:
472505
type: "string"
473506
notNull: false
507+
- column: "*:c_timestamp_noda_instant_override"
508+
csharp_type:
509+
type: "Instant"
510+
notNull: false
474511
```
475512
476513
</details>
@@ -518,6 +555,10 @@ overrides:
518555
csharp_type:
519556
type: "string"
520557
notNull: false
558+
- column: "*:c_timestamp_noda_instant_override"
559+
csharp_type:
560+
type: "Instant"
561+
notNull: false
521562
```
522563

523564
</details>
@@ -565,6 +606,10 @@ overrides:
565606
csharp_type:
566607
type: "string"
567608
notNull: false
609+
- column: "*:c_timestamp_noda_instant_override"
610+
csharp_type:
611+
type: "Instant"
612+
notNull: false
568613
```
569614

570615
</details>
@@ -612,6 +657,10 @@ overrides:
612657
csharp_type:
613658
type: "string"
614659
notNull: false
660+
- column: "*:c_timestamp_noda_instant_override"
661+
csharp_type:
662+
type: "Instant"
663+
notNull: false
615664
```
616665

617666
</details>
@@ -643,6 +692,10 @@ overrides:
643692
csharp_type:
644693
type: "string"
645694
notNull: false
695+
- column: "*:c_timestamp_noda_instant_override"
696+
csharp_type:
697+
type: "Instant"
698+
notNull: false
646699
```
647700

648701
</details>
@@ -674,6 +727,10 @@ overrides:
674727
csharp_type:
675728
type: "string"
676729
notNull: false
730+
- column: "*:c_timestamp_noda_instant_override"
731+
csharp_type:
732+
type: "Instant"
733+
notNull: false
677734
```
678735

679736
</details>
@@ -705,6 +762,10 @@ overrides:
705762
csharp_type:
706763
type: "string"
707764
notNull: false
765+
- column: "*:c_timestamp_noda_instant_override"
766+
csharp_type:
767+
type: "Instant"
768+
notNull: false
708769
```
709770

710771
</details>
@@ -736,6 +797,10 @@ overrides:
736797
csharp_type:
737798
type: "string"
738799
notNull: false
800+
- column: "*:c_timestamp_noda_instant_override"
801+
csharp_type:
802+
type: "Instant"
803+
notNull: false
739804
```
740805

741806
</details>
@@ -772,6 +837,12 @@ overrides:
772837
- column: "*:c_integer_bool_override"
773838
csharp_type:
774839
type: "bool"
840+
- column: "*:c_text_noda_instant_override"
841+
csharp_type:
842+
type: "Instant"
843+
- column: "*:c_integer_noda_instant_override"
844+
csharp_type:
845+
type: "Instant"
775846
```
776847

777848
</details>
@@ -808,6 +879,12 @@ overrides:
808879
- column: "*:c_integer_bool_override"
809880
csharp_type:
810881
type: "bool"
882+
- column: "*:c_text_noda_instant_override"
883+
csharp_type:
884+
type: "Instant"
885+
- column: "*:c_integer_noda_instant_override"
886+
csharp_type:
887+
type: "Instant"
811888
```
812889

813890
</details>
@@ -844,6 +921,12 @@ overrides:
844921
- column: "*:c_integer_bool_override"
845922
csharp_type:
846923
type: "bool"
924+
- column: "*:c_text_noda_instant_override"
925+
csharp_type:
926+
type: "Instant"
927+
- column: "*:c_integer_noda_instant_override"
928+
csharp_type:
929+
type: "Instant"
847930
```
848931

849932
</details>
@@ -880,6 +963,12 @@ overrides:
880963
- column: "*:c_integer_bool_override"
881964
csharp_type:
882965
type: "bool"
966+
- column: "*:c_text_noda_instant_override"
967+
csharp_type:
968+
type: "Instant"
969+
- column: "*:c_integer_noda_instant_override"
970+
csharp_type:
971+
type: "Instant"
883972
```
884973

885974
</details>

docs/02_Quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version: "2"
44
plugins:
55
- name: csharp
66
wasm:
7-
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.4/sqlc-gen-csharp.wasm
8-
sha256: ceb948980f5a49e2922824f068f812f9ac70287da6dcc8c8199c8b4ceeaec858
7+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.22.0/sqlc-gen-csharp.wasm
8+
sha256: 9de8713ddcde8f21787ed925fb65744aa04f027ea6c23320292dc31d28aab80d
99
sql:
1010
# For PostgresSQL
1111
- schema: schema.sql

0 commit comments

Comments
 (0)