Skip to content

Commit f37ede1

Browse files
update docs (#269)
Co-authored-by: SockworkOrange <26390445+SockworkOrange@users.noreply.github.com>
1 parent 321c3ec commit f37ede1

3 files changed

Lines changed: 126 additions & 79 deletions

File tree

README.md

Lines changed: 96 additions & 65 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.20.0/sqlc-gen-csharp.wasm
16-
sha256: 3d0a7d09a93b6135c4e043acbbd862d28e2535f20a43292a842a75ac37f35aa0
15+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.0/sqlc-gen-csharp.wasm
16+
sha256: 6a01b8c24418abff5d3c272dd1b4ad69f2b43939bb8866243947db3d167a079c
1717
sql:
1818
# For PostgresSQL
1919
- schema: schema.sql
@@ -70,6 +70,7 @@ overrides:
7070

7171
## Supported Features
7272
- ✅ means the feature is fully supported.
73+
- ⚠️ means SQLC does not yet support this feature, so it cannot be supported by the plugin yet.
7374
- 🚫 means the database does not support the feature.
7475
- ❌ means the feature is not supported by the plugin (but could be supported by the database).
7576

@@ -202,7 +203,7 @@ we consider support for the different data types separately for batch inserts an
202203
| varchar, character varying | ✅ | ✅ |
203204
| text | ✅ | ✅ |
204205
| bytea | ✅ | ✅ |
205-
| 2-dimensional arrays (e.g text[],int[]) | ✅ | |
206+
| 2-dimensional arrays (e.g text[],int[]) | ✅ | |
206207
| money | ✅ | ✅ |
207208
| point | ✅ | ✅ |
208209
| line | ✅ | ✅ |
@@ -211,23 +212,37 @@ we consider support for the different data types separately for batch inserts an
211212
| path | ✅ | ✅ |
212213
| polygon | ✅ | ✅ |
213214
| circle | ✅ | ✅ |
214-
| cidr | ✅ | |
215-
| inet | ✅ | |
216-
| macaddr | ✅ | |
217-
| macaddr8 | ✅ | |
218-
| tsvector | | ❌ |
219-
| tsquery | | ❌ |
215+
| cidr | ✅ | |
216+
| inet | ✅ | |
217+
| macaddr | ✅ | |
218+
| macaddr8 | ✅ | ⚠️ |
219+
| tsvector | | ❌ |
220+
| tsquery | | ❌ |
220221
| uuid | ✅ | ✅ |
221-
| json | ✅ | |
222-
| jsonb | ✅ | |
223-
| jsonpath | ✅ | |
224-
| xml | | |
225-
| enum | | |
222+
| json | ✅ | ⚠️ |
223+
| jsonb | ✅ | ⚠️ |
224+
| jsonpath | ✅ | ⚠️ |
225+
| xml | | ⚠️ |
226+
| enum | | ⚠️ |
226227

227228
*** `time with time zone` is not useful and not recommended to use by Postgres themselves -
228229
see [here](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME) -
229230
so we decided not to implement support for it.
230231

232+
*** Some data types require conversion in the INSERT statement, and SQLC disallows argument conversion in queries with `:copyfrom` annotation,
233+
which are used for batch inserts. These are the data types that require this conversion:
234+
1. `macaddr8`
235+
2. `json`
236+
3. `jsonb`
237+
4. `jsonpath`
238+
5. `xml`
239+
6. `enum`
240+
241+
An example of this conversion:
242+
```sql
243+
INSERT INTO tab1 (json_field) VALUES (sqlc.narg('json_field')::json);
244+
```
245+
231246
</details>
232247

233248
# MySQL
@@ -273,45 +288,45 @@ Since in batch insert the data is not validated by the SQL itself but written an
273288
we consider support for the different data types separately for batch inserts and everything else.
274289

275290
| DB Type | Supported? | Supported in Batch? |
276-
|---------------------------|------------|---------------------|
277-
| bool, boolean, tinyint(1) | ✅ | ✅ |
278-
| bit | ✅ | ✅ |
279-
| tinyint | ✅ | ✅ |
280-
| smallint | ✅ | ✅ |
281-
| mediumint | ✅ | ✅ |
282-
| integer, int | ✅ | ✅ |
283-
| bigint | ✅ | ✅ |
284-
| real | ✅ | ✅ |
285-
| numeric | ✅ | ✅ |
286-
| decimal | ✅ | ✅ |
287-
| double precision | ✅ | ✅ |
288-
| year | ✅ | ✅ |
289-
| date | ✅ | ✅ |
290-
| timestamp | ✅ | ✅ |
291-
| char | ✅ | ✅ |
292-
| nchar, national char | ✅ | ✅ |
293-
| varchar | ✅ | ✅ |
294-
| tinytext | ✅ | ✅ |
295-
| mediumtext | ✅ | ✅ |
296-
| text | ✅ | ✅ |
297-
| longtext | ✅ | ✅ |
298-
| binary | ✅ | ✅ |
299-
| varbinary | ✅ | ✅ |
300-
| tinyblob | ✅ | ✅ |
301-
| blob | ✅ | ✅ |
302-
| mediumblob | ✅ | ✅ |
303-
| longblob | ✅ | ✅ |
304-
| enum | ✅ | ✅ |
305-
| set | ❌ | ❌ |
306-
| json | ✅ | ✅ |
307-
| geometry | ❌ | ❌ |
308-
| point | ❌ | ❌ |
309-
| linestring | ❌ | ❌ |
310-
| polygon | ❌ | ❌ |
311-
| multipoint | ❌ | ❌ |
312-
| multilinestring | ❌ | ❌ |
313-
| multipolygon | ❌ | ❌ |
314-
| geometrycollection | ❌ | ❌ |
291+
|---------------------------|----|-------------|
292+
| bool, boolean, tinyint(1) | ✅ | ✅ |
293+
| bit | ✅ | ✅ |
294+
| tinyint | ✅ | ✅ |
295+
| smallint | ✅ | ✅ |
296+
| mediumint | ✅ | ✅ |
297+
| integer, int | ✅ | ✅ |
298+
| bigint | ✅ | ✅ |
299+
| real | ✅ | ✅ |
300+
| numeric | ✅ | ✅ |
301+
| decimal | ✅ | ✅ |
302+
| double precision | ✅ | ✅ |
303+
| year | ✅ | ✅ |
304+
| date | ✅ | ✅ |
305+
| timestamp | ✅ | ✅ |
306+
| char | ✅ | ✅ |
307+
| nchar, national char | ✅ | ✅ |
308+
| varchar | ✅ | ✅ |
309+
| tinytext | ✅ | ✅ |
310+
| mediumtext | ✅ | ✅ |
311+
| text | ✅ | ✅ |
312+
| longtext | ✅ | ✅ |
313+
| binary | ✅ | ✅ |
314+
| varbinary | ✅ | ✅ |
315+
| tinyblob | ✅ | ✅ |
316+
| blob | ✅ | ✅ |
317+
| mediumblob | ✅ | ✅ |
318+
| longblob | ✅ | ✅ |
319+
| enum | ✅ | ✅ |
320+
| set | ✅ | ✅ |
321+
| json | ✅ | ✅ |
322+
| geometry | ⚠️ | ⚠️ |
323+
| point | ⚠️ | ⚠️ |
324+
| linestring | ⚠️ | ⚠️ |
325+
| polygon | ⚠️ | ⚠️ |
326+
| multipoint | ⚠️ | ⚠️ |
327+
| multilinestring | ⚠️ | ⚠️ |
328+
| multipolygon | ⚠️ | ⚠️ |
329+
| geometrycollection | ⚠️ | ⚠️ |
315330

316331
</details>
317332

@@ -408,7 +423,7 @@ The new created tag will create a draft release with it, in the release there wi
408423
<summary>Npgsql</summary>
409424
410425
## Engine `postgresql`: [NpgsqlExample](examples/NpgsqlExample)
411-
### [Schema](examples/config/postgresql/schema.sql) | [Queries](examples/config/postgresql/query.sql) | [End2End Test](end2end/EndToEndTests/NpgsqlTester.cs)
426+
### [Schema](examples/config/postgresql/authors/schema.sql) | [Queries](examples/config/postgresql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/NpgsqlTester.cs)
412427
### Config
413428
```yaml
414429
useDapper: false
@@ -432,6 +447,10 @@ overrides:
432447
csharp_type:
433448
type: "string"
434449
notNull: false
450+
- column: "*:c_xml_string_override"
451+
csharp_type:
452+
type: "string"
453+
notNull: false
435454
- column: "*:c_macaddr8"
436455
csharp_type:
437456
type: "string"
@@ -443,7 +462,7 @@ overrides:
443462
<summary>NpgsqlDapper</summary>
444463

445464
## Engine `postgresql`: [NpgsqlDapperExample](examples/NpgsqlDapperExample)
446-
### [Schema](examples/config/postgresql/schema.sql) | [Queries](examples/config/postgresql/query.sql) | [End2End Test](end2end/EndToEndTests/NpgsqlDapperTester.cs)
465+
### [Schema](examples/config/postgresql/authors/schema.sql) | [Queries](examples/config/postgresql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/NpgsqlDapperTester.cs)
447466
### Config
448467
```yaml
449468
useDapper: true
@@ -467,6 +486,10 @@ overrides:
467486
csharp_type:
468487
type: "string"
469488
notNull: false
489+
- column: "*:c_xml_string_override"
490+
csharp_type:
491+
type: "string"
492+
notNull: false
470493
- column: "*:c_macaddr8"
471494
csharp_type:
472495
type: "string"
@@ -478,7 +501,7 @@ overrides:
478501
<summary>NpgsqlLegacy</summary>
479502
480503
## Engine `postgresql`: [NpgsqlLegacyExample](examples/NpgsqlLegacyExample)
481-
### [Schema](examples/config/postgresql/schema.sql) | [Queries](examples/config/postgresql/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/NpgsqlTester.cs)
504+
### [Schema](examples/config/postgresql/authors/schema.sql) | [Queries](examples/config/postgresql/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/NpgsqlTester.cs)
482505
### Config
483506
```yaml
484507
useDapper: false
@@ -502,6 +525,10 @@ overrides:
502525
csharp_type:
503526
type: "string"
504527
notNull: false
528+
- column: "*:c_xml_string_override"
529+
csharp_type:
530+
type: "string"
531+
notNull: false
505532
- column: "*:c_macaddr8"
506533
csharp_type:
507534
type: "string"
@@ -513,7 +540,7 @@ overrides:
513540
<summary>NpgsqlDapperLegacy</summary>
514541

515542
## Engine `postgresql`: [NpgsqlDapperLegacyExample](examples/NpgsqlDapperLegacyExample)
516-
### [Schema](examples/config/postgresql/schema.sql) | [Queries](examples/config/postgresql/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/NpgsqlDapperTester.cs)
543+
### [Schema](examples/config/postgresql/authors/schema.sql) | [Queries](examples/config/postgresql/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/NpgsqlDapperTester.cs)
517544
### Config
518545
```yaml
519546
useDapper: true
@@ -537,6 +564,10 @@ overrides:
537564
csharp_type:
538565
type: "string"
539566
notNull: false
567+
- column: "*:c_xml_string_override"
568+
csharp_type:
569+
type: "string"
570+
notNull: false
540571
- column: "*:c_macaddr8"
541572
csharp_type:
542573
type: "string"
@@ -548,7 +579,7 @@ overrides:
548579
<summary>MySqlConnector</summary>
549580

550581
## Engine `mysql`: [MySqlConnectorExample](examples/MySqlConnectorExample)
551-
### [Schema](examples/config/mysql/schema.sql) | [Queries](examples/config/mysql/query.sql) | [End2End Test](end2end/EndToEndTests/MySqlConnectorTester.cs)
582+
### [Schema](examples/config/mysql/authors/schema.sql) | [Queries](examples/config/mysql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/MySqlConnectorTester.cs)
552583
### Config
553584
```yaml
554585
useDapper: false
@@ -579,7 +610,7 @@ overrides:
579610
<summary>MySqlConnectorDapper</summary>
580611

581612
## Engine `mysql`: [MySqlConnectorDapperExample](examples/MySqlConnectorDapperExample)
582-
### [Schema](examples/config/mysql/schema.sql) | [Queries](examples/config/mysql/query.sql) | [End2End Test](end2end/EndToEndTests/MySqlConnectorDapperTester.cs)
613+
### [Schema](examples/config/mysql/authors/schema.sql) | [Queries](examples/config/mysql/authors/query.sql) | [End2End Test](end2end/EndToEndTests/MySqlConnectorDapperTester.cs)
583614
### Config
584615
```yaml
585616
useDapper: true
@@ -610,7 +641,7 @@ overrides:
610641
<summary>MySqlConnectorLegacy</summary>
611642

612643
## Engine `mysql`: [MySqlConnectorLegacyExample](examples/MySqlConnectorLegacyExample)
613-
### [Schema](examples/config/mysql/schema.sql) | [Queries](examples/config/mysql/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/MySqlConnectorTester.cs)
644+
### [Schema](examples/config/mysql/authors/schema.sql) | [Queries](examples/config/mysql/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/MySqlConnectorTester.cs)
614645
### Config
615646
```yaml
616647
useDapper: false
@@ -641,7 +672,7 @@ overrides:
641672
<summary>MySqlConnectorDapperLegacy</summary>
642673

643674
## Engine `mysql`: [MySqlConnectorDapperLegacyExample](examples/MySqlConnectorDapperLegacyExample)
644-
### [Schema](examples/config/mysql/schema.sql) | [Queries](examples/config/mysql/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/MySqlConnectorDapperTester.cs)
675+
### [Schema](examples/config/mysql/authors/schema.sql) | [Queries](examples/config/mysql/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/MySqlConnectorDapperTester.cs)
645676
### Config
646677
```yaml
647678
useDapper: true
@@ -672,7 +703,7 @@ overrides:
672703
<summary>Sqlite</summary>
673704

674705
## Engine `sqlite`: [SqliteExample](examples/SqliteExample)
675-
### [Schema](examples/config/sqlite/schema.sql) | [Queries](examples/config/sqlite/query.sql) | [End2End Test](end2end/EndToEndTests/SqliteTester.cs)
706+
### [Schema](examples/config/sqlite/authors/schema.sql) | [Queries](examples/config/sqlite/authors/query.sql) | [End2End Test](end2end/EndToEndTests/SqliteTester.cs)
676707
### Config
677708
```yaml
678709
useDapper: false
@@ -699,7 +730,7 @@ overrides:
699730
<summary>SqliteDapper</summary>
700731

701732
## Engine `sqlite`: [SqliteDapperExample](examples/SqliteDapperExample)
702-
### [Schema](examples/config/sqlite/schema.sql) | [Queries](examples/config/sqlite/query.sql) | [End2End Test](end2end/EndToEndTests/SqliteDapperTester.cs)
733+
### [Schema](examples/config/sqlite/authors/schema.sql) | [Queries](examples/config/sqlite/authors/query.sql) | [End2End Test](end2end/EndToEndTests/SqliteDapperTester.cs)
703734
### Config
704735
```yaml
705736
useDapper: true
@@ -726,7 +757,7 @@ overrides:
726757
<summary>SqliteLegacy</summary>
727758

728759
## Engine `sqlite`: [SqliteLegacyExample](examples/SqliteLegacyExample)
729-
### [Schema](examples/config/sqlite/schema.sql) | [Queries](examples/config/sqlite/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/SqliteTester.cs)
760+
### [Schema](examples/config/sqlite/authors/schema.sql) | [Queries](examples/config/sqlite/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/SqliteTester.cs)
730761
### Config
731762
```yaml
732763
useDapper: false
@@ -753,7 +784,7 @@ overrides:
753784
<summary>SqliteDapperLegacy</summary>
754785

755786
## Engine `sqlite`: [SqliteDapperLegacyExample](examples/SqliteDapperLegacyExample)
756-
### [Schema](examples/config/sqlite/schema.sql) | [Queries](examples/config/sqlite/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/SqliteDapperTester.cs)
787+
### [Schema](examples/config/sqlite/authors/schema.sql) | [Queries](examples/config/sqlite/authors/query.sql) | [End2End Test](end2end/EndToEndTestsLegacy/SqliteDapperTester.cs)
757788
### Config
758789
```yaml
759790
useDapper: true

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.20.0/sqlc-gen-csharp.wasm
8-
sha256: 3d0a7d09a93b6135c4e043acbbd862d28e2535f20a43292a842a75ac37f35aa0
7+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.0/sqlc-gen-csharp.wasm
8+
sha256: 6a01b8c24418abff5d3c272dd1b4ad69f2b43939bb8866243947db3d167a079c
99
sql:
1010
# For PostgresSQL
1111
- schema: schema.sql

0 commit comments

Comments
 (0)