Skip to content

Commit 133d684

Browse files
update docs (#320)
Co-authored-by: SockworkOrange <[email protected]>
1 parent ecda614 commit 133d684

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

README.md

Lines changed: 45 additions & 2 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.2/sqlc-gen-csharp.wasm
16-
sha256: 98990c2a46b0e315c7f062f5643e3404ed4150a5ef2808c47a4e10084443506e
15+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.3/sqlc-gen-csharp.wasm
16+
sha256: a295dd8438c93c1b93d9d6d9e7706913dfade92caf19dbe86ed533214d3dc1ed
1717
sql:
1818
# For PostgresSQL
1919
- schema: schema.sql
@@ -364,6 +364,17 @@ INSERT INTO tab1 (field1, field2) VALUES
364364
| text | ✅ |
365365
| blob | ✅ |
366366

367+
## Useful Overrides
368+
It's possible to use the override data type functionality of the plugin thus overcoming the limited
369+
amount of data types that are supported by SQLite. The supported overrides are specified below:
370+
371+
| DB Type | C# Type Override | Supported? | Description |
372+
|---------|------------------|------------|------------------------------------------------------------------|
373+
| integer | DateTime | ✅ | Unix Epoch - seconds since 1-1-1970 |
374+
| text | DateTime | ✅ | String representation of the datetime in a configurable format |
375+
| integer | bool | ❌ | If x equals 0 -> False, otherwise -> True |
376+
| text | bool | ❌ | Converts string to a boolean value using Convert.ToBoolean rules |
377+
367378
</details>
368379

369380
# Contributing
@@ -753,6 +764,14 @@ overrides:
753764
csharp_type:
754765
type: "decimal"
755766
notNull: true
767+
- column: "*:c_text_datetime_override"
768+
csharp_type:
769+
type: "DateTime"
770+
notNull: false
771+
- column: "*:c_integer_datetime_override"
772+
csharp_type:
773+
type: "DateTime"
774+
notNull: false
756775
```
757776

758777
</details>
@@ -780,6 +799,14 @@ overrides:
780799
csharp_type:
781800
type: "decimal"
782801
notNull: true
802+
- column: "*:c_text_datetime_override"
803+
csharp_type:
804+
type: "DateTime"
805+
notNull: false
806+
- column: "*:c_integer_datetime_override"
807+
csharp_type:
808+
type: "DateTime"
809+
notNull: false
783810
```
784811

785812
</details>
@@ -807,6 +834,14 @@ overrides:
807834
csharp_type:
808835
type: "decimal"
809836
notNull: true
837+
- column: "*:c_text_datetime_override"
838+
csharp_type:
839+
type: "DateTime"
840+
notNull: false
841+
- column: "*:c_integer_datetime_override"
842+
csharp_type:
843+
type: "DateTime"
844+
notNull: false
810845
```
811846

812847
</details>
@@ -834,6 +869,14 @@ overrides:
834869
csharp_type:
835870
type: "decimal"
836871
notNull: true
872+
- column: "*:c_text_datetime_override"
873+
csharp_type:
874+
type: "DateTime"
875+
notNull: false
876+
- column: "*:c_integer_datetime_override"
877+
csharp_type:
878+
type: "DateTime"
879+
notNull: false
837880
```
838881

839882
</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.2/sqlc-gen-csharp.wasm
8-
sha256: 98990c2a46b0e315c7f062f5643e3404ed4150a5ef2808c47a4e10084443506e
7+
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.3/sqlc-gen-csharp.wasm
8+
sha256: a295dd8438c93c1b93d9d6d9e7706913dfade92caf19dbe86ed533214d3dc1ed
99
sql:
1010
# For PostgresSQL
1111
- schema: schema.sql

docs/08_Examples.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@ overrides:
335335
csharp_type:
336336
type: "decimal"
337337
notNull: true
338+
- column: "*:c_text_datetime_override"
339+
csharp_type:
340+
type: "DateTime"
341+
notNull: false
342+
- column: "*:c_integer_datetime_override"
343+
csharp_type:
344+
type: "DateTime"
345+
notNull: false
338346
```
339347

340348
</details>
@@ -362,6 +370,14 @@ overrides:
362370
csharp_type:
363371
type: "decimal"
364372
notNull: true
373+
- column: "*:c_text_datetime_override"
374+
csharp_type:
375+
type: "DateTime"
376+
notNull: false
377+
- column: "*:c_integer_datetime_override"
378+
csharp_type:
379+
type: "DateTime"
380+
notNull: false
365381
```
366382

367383
</details>
@@ -389,6 +405,14 @@ overrides:
389405
csharp_type:
390406
type: "decimal"
391407
notNull: true
408+
- column: "*:c_text_datetime_override"
409+
csharp_type:
410+
type: "DateTime"
411+
notNull: false
412+
- column: "*:c_integer_datetime_override"
413+
csharp_type:
414+
type: "DateTime"
415+
notNull: false
392416
```
393417

394418
</details>
@@ -416,6 +440,14 @@ overrides:
416440
csharp_type:
417441
type: "decimal"
418442
notNull: true
443+
- column: "*:c_text_datetime_override"
444+
csharp_type:
445+
type: "DateTime"
446+
notNull: false
447+
- column: "*:c_integer_datetime_override"
448+
csharp_type:
449+
type: "DateTime"
450+
notNull: false
419451
```
420452

421453
</details>

0 commit comments

Comments
 (0)