Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ version: "2"
plugins:
- name: csharp
wasm:
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.2/sqlc-gen-csharp.wasm
sha256: 98990c2a46b0e315c7f062f5643e3404ed4150a5ef2808c47a4e10084443506e
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.3/sqlc-gen-csharp.wasm
sha256: a295dd8438c93c1b93d9d6d9e7706913dfade92caf19dbe86ed533214d3dc1ed
sql:
# For PostgresSQL
- schema: schema.sql
Expand Down Expand Up @@ -364,6 +364,17 @@ INSERT INTO tab1 (field1, field2) VALUES
| text | ✅ |
| blob | ✅ |

## Useful Overrides
It's possible to use the override data type functionality of the plugin thus overcoming the limited
amount of data types that are supported by SQLite. The supported overrides are specified below:

| DB Type | C# Type Override | Supported? | Description |
|---------|------------------|------------|------------------------------------------------------------------|
| integer | DateTime | ✅ | Unix Epoch - seconds since 1-1-1970 |
| text | DateTime | ✅ | String representation of the datetime in a configurable format |
| integer | bool | ❌ | If x equals 0 -> False, otherwise -> True |
| text | bool | ❌ | Converts string to a boolean value using Convert.ToBoolean rules |

</details>

# Contributing
Expand Down Expand Up @@ -753,6 +764,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -780,6 +799,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -807,6 +834,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -834,6 +869,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
4 changes: 2 additions & 2 deletions docs/02_Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: "2"
plugins:
- name: csharp
wasm:
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.2/sqlc-gen-csharp.wasm
sha256: 98990c2a46b0e315c7f062f5643e3404ed4150a5ef2808c47a4e10084443506e
url: https://github.com/DaredevilOSS/sqlc-gen-csharp/releases/download/v0.21.3/sqlc-gen-csharp.wasm
sha256: a295dd8438c93c1b93d9d6d9e7706913dfade92caf19dbe86ed533214d3dc1ed
sql:
# For PostgresSQL
- schema: schema.sql
Expand Down
32 changes: 32 additions & 0 deletions docs/08_Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -362,6 +370,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -389,6 +405,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>
Expand Down Expand Up @@ -416,6 +440,14 @@ overrides:
csharp_type:
type: "decimal"
notNull: true
- column: "*:c_text_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
- column: "*:c_integer_datetime_override"
csharp_type:
type: "DateTime"
notNull: false
```

</details>