Skip to content

Commit 2dd8a08

Browse files
add collapse to DB docs
1 parent ec6a5a6 commit 2dd8a08

File tree

4 files changed

+78
-22
lines changed

4 files changed

+78
-22
lines changed

README.md

+39-12
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,22 @@ More info can be found in [here](https://docs.sqlc.dev/en/stable/reference/query
9292

9393
More info can be found in [here](https://docs.sqlc.dev/en/stable/reference/macros.html#macros).
9494
# PostgresSQL
95-
## :execlastid - Implementation
95+
<details>
96+
<summary>:execlastid - Implementation</summary>
97+
9698
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
9799
data type that can have a unique constraint.
100+
</details>
101+
102+
<details>
103+
<summary>:copyfrom - Implementation</summary>
98104

99-
## :copyfrom - Implementation
100105
Implemented via the `COPY FROM` command which can load binary data directly from `stdin`.
106+
</details>
107+
108+
<details>
109+
<summary>Supported Data Types</summary>
101110

102-
## Data Types
103111
Since in batch insert the data is not validated by the SQL itself but written in a binary format,
104112
we consider support for the different data types separately for batch inserts and everything else.
105113

@@ -141,9 +149,11 @@ we consider support for the different data types separately for batch inserts an
141149
| json | ❌ | ❌ |
142150
| jsonb | ❌ | ❌ |
143151
| jsonpath | ❌ | ❌ |
144-
# MySQL
145152

146-
## :execlastid - Implementation
153+
</details># MySQL
154+
<details>
155+
<summary>:execlastid - Implementation</summary>
156+
147157
The implementation differs if we're using `Dapper` or not.
148158

149159
### Driver - MySqlConnector
@@ -165,14 +175,20 @@ appended to the original query like this:
165175
INSERT INTO tab1 (field1, field2) VALUES ('a', 1);
166176
SELECT LAST_INSERT_ID();
167177
```
168-
169178
The generated method will return `int` & `long` for `serial` & `bigserial` respectively.
170179

171-
## :copyfrom - Implementation
180+
</details>
181+
182+
<details>
183+
<summary>:copyfrom - Implementation</summary>
172184
Implemented via the `LOAD DATA` command which can load data from a `CSV` file to a table.
173185
Requires us to first save the input batch as a CSV, and then load it via the driver.
174186

175-
## Data Types
187+
</details>
188+
189+
<details>
190+
<summary>Supported Data Types</summary>
191+
176192
Since in batch insert the data is not validated by the SQL itself but written and read from a CSV,
177193
we consider support for the different data types separately for batch inserts and everything else.
178194

@@ -216,7 +232,10 @@ we consider support for the different data types separately for batch inserts an
216232
| multilinestring | ❌ | ❌ |
217233
| multipolygon | ❌ | ❌ |
218234
| geometrycollection | ❌ | ❌ |
219-
# SQLite3
235+
236+
</details># SQLite3
237+
<details>
238+
<summary>:execlastid - Implementation</summary>
220239

221240
## :execlastid - Implementation
222241
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
@@ -226,7 +245,10 @@ data type that can have a unique constraint.
226245
INSERT INTO tab1 (field1, field2) VALUES ('a', 1) RETURNING id_field;
227246
```
228247

229-
## :copyfrom - Implementation
248+
</details>
249+
250+
<details>
251+
<summary>:copyfrom - Implementation</summary>
230252
Implemented via a multi `VALUES` clause, like this:
231253

232254
```sql
@@ -236,14 +258,19 @@ INSERT INTO tab1 (field1, field2) VALUES
236258
('c', 3);
237259
```
238260

239-
## Data Types
261+
</details>
262+
263+
<details>
264+
<summary>Supported Data Types</summary>
240265

241266
| DB Type | Supported? |
242267
|---------|------------|
243268
| integer | ✅ |
244269
| real | ✅ |
245270
| text | ✅ |
246-
| blob | ✅ |# Contributing
271+
| blob | ✅ |
272+
273+
</details># Contributing
247274
## Local plugin development
248275
### Prerequisites
249276
Make sure that the following applications are installed and added to your path.

docs/04_Postgres.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
# PostgresSQL
2-
## :execlastid - Implementation
2+
<details>
3+
<summary>:execlastid - Implementation</summary>
4+
35
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
46
data type that can have a unique constraint.
7+
</details>
8+
9+
<details>
10+
<summary>:copyfrom - Implementation</summary>
511

6-
## :copyfrom - Implementation
712
Implemented via the `COPY FROM` command which can load binary data directly from `stdin`.
13+
</details>
14+
15+
<details>
16+
<summary>Supported Data Types</summary>
817

9-
## Data Types
1018
Since in batch insert the data is not validated by the SQL itself but written in a binary format,
1119
we consider support for the different data types separately for batch inserts and everything else.
1220

@@ -48,3 +56,5 @@ we consider support for the different data types separately for batch inserts an
4856
| json |||
4957
| jsonb |||
5058
| jsonpath |||
59+
60+
</details>

docs/05_MySql.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# MySQL
2+
<details>
3+
<summary>:execlastid - Implementation</summary>
24

3-
## :execlastid - Implementation
45
The implementation differs if we're using `Dapper` or not.
56

67
### Driver - MySqlConnector
@@ -22,14 +23,20 @@ appended to the original query like this:
2223
INSERT INTO tab1 (field1, field2) VALUES ('a', 1);
2324
SELECT LAST_INSERT_ID();
2425
```
25-
2626
The generated method will return `int` & `long` for `serial` & `bigserial` respectively.
2727

28-
## :copyfrom - Implementation
28+
</details>
29+
30+
<details>
31+
<summary>:copyfrom - Implementation</summary>
2932
Implemented via the `LOAD DATA` command which can load data from a `CSV` file to a table.
3033
Requires us to first save the input batch as a CSV, and then load it via the driver.
3134

32-
## Data Types
35+
</details>
36+
37+
<details>
38+
<summary>Supported Data Types</summary>
39+
3340
Since in batch insert the data is not validated by the SQL itself but written and read from a CSV,
3441
we consider support for the different data types separately for batch inserts and everything else.
3542

@@ -73,3 +80,5 @@ we consider support for the different data types separately for batch inserts an
7380
| multilinestring |||
7481
| multipolygon |||
7582
| geometrycollection |||
83+
84+
</details>

docs/06_Sqlite.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# SQLite3
2+
<details>
3+
<summary>:execlastid - Implementation</summary>
24

35
## :execlastid - Implementation
46
Implemented via a `RETURNING` clause, allowing the `INSERT` command to return the newly created id, which can be of any
@@ -8,7 +10,10 @@ data type that can have a unique constraint.
810
INSERT INTO tab1 (field1, field2) VALUES ('a', 1) RETURNING id_field;
911
```
1012

11-
## :copyfrom - Implementation
13+
</details>
14+
15+
<details>
16+
<summary>:copyfrom - Implementation</summary>
1217
Implemented via a multi `VALUES` clause, like this:
1318

1419
```sql
@@ -18,11 +23,16 @@ INSERT INTO tab1 (field1, field2) VALUES
1823
('c', 3);
1924
```
2025

21-
## Data Types
26+
</details>
27+
28+
<details>
29+
<summary>Supported Data Types</summary>
2230

2331
| DB Type | Supported? |
2432
|---------|------------|
2533
| integer ||
2634
| real ||
2735
| text ||
28-
| blob ||
36+
| blob ||
37+
38+
</details>

0 commit comments

Comments
 (0)