Skip to content

Commit 01a05c4

Browse files
update docs (#259)
Co-authored-by: SockworkOrange <26390445+SockworkOrange@users.noreply.github.com>
1 parent bbee0b2 commit 01a05c4

3 files changed

Lines changed: 129 additions & 49 deletions

File tree

README.md

Lines changed: 83 additions & 35 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.18.0/sqlc-gen-csharp.wasm
16-
sha256: 5564052d3133c4127c067b7528e2b62e78ccf03cb99c7fc2aade0764b9455125
15+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.19.0/sqlc-gen-csharp.wasm
16+
sha256: 82e1a2dfc44ba5052c1e310aa2cda82d2825b8dc57000ce4dd6519249e5ea0fe
1717
sql:
1818
# For PostgresSQL
1919
- schema: schema.sql
@@ -50,6 +50,7 @@ sql:
5050
| 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. | |
5151

5252
### Override option
53+
Override for a specific query:
5354
```yaml
5455
overrides:
5556
- column: "<query-name>:<field-name>"
@@ -58,6 +59,15 @@ overrides:
5859
notNull: true|false
5960
```
6061

62+
Override for all queries:
63+
```yaml
64+
overrides:
65+
- column: "*:<field-name>"
66+
csharp_type:
67+
type: "<csharp-datatype>"
68+
notNull: true|false
69+
```
70+
6171
## Supported Features
6272
- ✅ means the feature is fully supported.
6373
- 🚫 means the database does not support the feature.
@@ -165,7 +175,7 @@ Since in batch insert the data is not validated by the SQL itself but written in
165175
we consider support for the different data types separately for batch inserts and everything else.
166176

167177
| DB Type | Supported? | Supported in Batch? |
168-
|-----------------------------------------|-----------|---------------------|
178+
|-----------------------------------------|------------|-------------------- |
169179
| boolean | ✅ | ✅ |
170180
| smallint | ✅ | ✅ |
171181
| integer | ✅ | ✅ |
@@ -177,32 +187,38 @@ we consider support for the different data types separately for batch inserts an
177187
| timestamp, timestamp without time zone | ✅ | ✅ |
178188
| timestamp with time zone | ✅ | ✅ |
179189
| time, time without time zone | ✅ | ✅ |
180-
| time with time zone | | |
181-
| interval | | |
190+
| time with time zone | 🚫 | 🚫 |
191+
| interval | | |
182192
| char | ✅ | ✅ |
183-
| bpchar | | |
193+
| bpchar | | |
184194
| varchar, character varying | ✅ | ✅ |
185195
| text | ✅ | ✅ |
186196
| bytea | ✅ | ✅ |
187197
| 2-dimensional arrays (e.g text[],int[]) | ✅ | ❌ |
188198
| money | ✅ | ✅ |
189-
| point | ✅ | |
190-
| line | ✅ | |
191-
| lseg | ✅ | |
192-
| box | ✅ | |
193-
| path | ✅ | |
194-
| polygon | ✅ | |
195-
| circle | ✅ | |
196-
| cidr | | ❌ |
197-
| inet | | ❌ |
198-
| macaddr | | ❌ |
199-
| macaddr8 | | ❌ |
199+
| point | ✅ | |
200+
| line | ✅ | |
201+
| lseg | ✅ | |
202+
| box | ✅ | |
203+
| path | ✅ | |
204+
| polygon | ✅ | |
205+
| circle | ✅ | |
206+
| cidr | | ❌ |
207+
| inet | | ❌ |
208+
| macaddr | | ❌ |
209+
| macaddr8 | | ❌ |
200210
| tsvector | ❌ | ❌ |
201211
| tsquery | ❌ | ❌ |
202-
| uuid | ❌ | ❌ |
203-
| json | ❌ | ❌ |
204-
| jsonb | ❌ | ❌ |
205-
| jsonpath | ❌ | ❌ |
212+
| uuid | ✅ | ✅ |
213+
| json | ✅ | ❌ |
214+
| jsonb | ✅ | ❌ |
215+
| jsonpath | ✅ | ❌ |
216+
| xml | ❌ | ❌ |
217+
| enum | ❌ | ❌ |
218+
219+
*** `time with time zone` is not useful and not recommended to use by Postgres themselves -
220+
see [here](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME) -
221+
so we decided not to implement support for it.
206222

207223
</details>
208224

@@ -277,9 +293,9 @@ we consider support for the different data types separately for batch inserts an
277293
| blob | ✅ | ✅ |
278294
| mediumblob | ✅ | ✅ |
279295
| longblob | ✅ | ✅ |
280-
| enum | | |
296+
| enum | | |
281297
| set | ❌ | ❌ |
282-
| json | | |
298+
| json | | |
283299
| geometry | ❌ | ❌ |
284300
| point | ❌ | ❌ |
285301
| linestring | ❌ | ❌ |
@@ -405,6 +421,14 @@ overrides:
405421
csharp_type:
406422
type: "DateTime"
407423
notNull: true
424+
- column: "*:c_json_string_override"
425+
csharp_type:
426+
type: "string"
427+
notNull: false
428+
- column: "*:c_macaddr8"
429+
csharp_type:
430+
type: "string"
431+
notNull: false
408432
```
409433

410434
</details>
@@ -432,6 +456,14 @@ overrides:
432456
csharp_type:
433457
type: "DateTime"
434458
notNull: true
459+
- column: "*:c_json_string_override"
460+
csharp_type:
461+
type: "string"
462+
notNull: false
463+
- column: "*:c_macaddr8"
464+
csharp_type:
465+
type: "string"
466+
notNull: false
435467
```
436468
437469
</details>
@@ -459,6 +491,14 @@ overrides:
459491
csharp_type:
460492
type: "DateTime"
461493
notNull: true
494+
- column: "*:c_json_string_override"
495+
csharp_type:
496+
type: "string"
497+
notNull: false
498+
- column: "*:c_macaddr8"
499+
csharp_type:
500+
type: "string"
501+
notNull: false
462502
```
463503

464504
</details>
@@ -486,6 +526,14 @@ overrides:
486526
csharp_type:
487527
type: "DateTime"
488528
notNull: true
529+
- column: "*:c_json_string_override"
530+
csharp_type:
531+
type: "string"
532+
notNull: false
533+
- column: "*:c_macaddr8"
534+
csharp_type:
535+
type: "string"
536+
notNull: false
489537
```
490538

491539
</details>
@@ -513,10 +561,10 @@ overrides:
513561
csharp_type:
514562
type: "DateTime"
515563
notNull: true
516-
- column: "GetMysqlFunctions:max_bigint"
564+
- column: "*:c_json_string_override"
517565
csharp_type:
518-
type: "long"
519-
notNull: true
566+
type: "string"
567+
notNull: false
520568
```
521569

522570
</details>
@@ -544,10 +592,10 @@ overrides:
544592
csharp_type:
545593
type: "DateTime"
546594
notNull: true
547-
- column: "GetMysqlFunctions:max_bigint"
595+
- column: "*:c_json_string_override"
548596
csharp_type:
549-
type: "long"
550-
notNull: true
597+
type: "string"
598+
notNull: false
551599
```
552600

553601
</details>
@@ -575,10 +623,10 @@ overrides:
575623
csharp_type:
576624
type: "DateTime"
577625
notNull: true
578-
- column: "GetMysqlFunctions:max_bigint"
626+
- column: "*:c_json_string_override"
579627
csharp_type:
580-
type: "long"
581-
notNull: true
628+
type: "string"
629+
notNull: false
582630
```
583631

584632
</details>
@@ -606,10 +654,10 @@ overrides:
606654
csharp_type:
607655
type: "DateTime"
608656
notNull: true
609-
- column: "GetMysqlFunctions:max_bigint"
657+
- column: "*:c_json_string_override"
610658
csharp_type:
611-
type: "long"
612-
notNull: true
659+
type: "string"
660+
notNull: false
613661
```
614662

615663
</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.18.0/sqlc-gen-csharp.wasm
8-
sha256: 5564052d3133c4127c067b7528e2b62e78ccf03cb99c7fc2aade0764b9455125
7+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.19.0/sqlc-gen-csharp.wasm
8+
sha256: 82e1a2dfc44ba5052c1e310aa2cda82d2825b8dc57000ce4dd6519249e5ea0fe
99
sql:
1010
# For PostgresSQL
1111
- schema: schema.sql

docs/08_Examples.md

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ overrides:
2323
csharp_type:
2424
type: "DateTime"
2525
notNull: true
26+
- column: "*:c_json_string_override"
27+
csharp_type:
28+
type: "string"
29+
notNull: false
30+
- column: "*:c_macaddr8"
31+
csharp_type:
32+
type: "string"
33+
notNull: false
2634
```
2735
2836
</details>
@@ -50,6 +58,14 @@ overrides:
5058
csharp_type:
5159
type: "DateTime"
5260
notNull: true
61+
- column: "*:c_json_string_override"
62+
csharp_type:
63+
type: "string"
64+
notNull: false
65+
- column: "*:c_macaddr8"
66+
csharp_type:
67+
type: "string"
68+
notNull: false
5369
```
5470

5571
</details>
@@ -77,6 +93,14 @@ overrides:
7793
csharp_type:
7894
type: "DateTime"
7995
notNull: true
96+
- column: "*:c_json_string_override"
97+
csharp_type:
98+
type: "string"
99+
notNull: false
100+
- column: "*:c_macaddr8"
101+
csharp_type:
102+
type: "string"
103+
notNull: false
80104
```
81105

82106
</details>
@@ -104,6 +128,14 @@ overrides:
104128
csharp_type:
105129
type: "DateTime"
106130
notNull: true
131+
- column: "*:c_json_string_override"
132+
csharp_type:
133+
type: "string"
134+
notNull: false
135+
- column: "*:c_macaddr8"
136+
csharp_type:
137+
type: "string"
138+
notNull: false
107139
```
108140

109141
</details>
@@ -131,10 +163,10 @@ overrides:
131163
csharp_type:
132164
type: "DateTime"
133165
notNull: true
134-
- column: "GetMysqlFunctions:max_bigint"
166+
- column: "*:c_json_string_override"
135167
csharp_type:
136-
type: "long"
137-
notNull: true
168+
type: "string"
169+
notNull: false
138170
```
139171

140172
</details>
@@ -162,10 +194,10 @@ overrides:
162194
csharp_type:
163195
type: "DateTime"
164196
notNull: true
165-
- column: "GetMysqlFunctions:max_bigint"
197+
- column: "*:c_json_string_override"
166198
csharp_type:
167-
type: "long"
168-
notNull: true
199+
type: "string"
200+
notNull: false
169201
```
170202

171203
</details>
@@ -193,10 +225,10 @@ overrides:
193225
csharp_type:
194226
type: "DateTime"
195227
notNull: true
196-
- column: "GetMysqlFunctions:max_bigint"
228+
- column: "*:c_json_string_override"
197229
csharp_type:
198-
type: "long"
199-
notNull: true
230+
type: "string"
231+
notNull: false
200232
```
201233

202234
</details>
@@ -224,10 +256,10 @@ overrides:
224256
csharp_type:
225257
type: "DateTime"
226258
notNull: true
227-
- column: "GetMysqlFunctions:max_bigint"
259+
- column: "*:c_json_string_override"
228260
csharp_type:
229-
type: "long"
230-
notNull: true
261+
type: "string"
262+
notNull: false
231263
```
232264

233265
</details>

0 commit comments

Comments
 (0)