Skip to content

Commit 643fdff

Browse files
committed
Add readme union feature
1 parent 1d55af7 commit 643fdff

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ Currently, it can only perform select queries.
1212

1313
## TODO:
1414

15-
- Implement Union queries
16-
- Insert Query
15+
- More Queries
1716
- Validate SQL Syntax
1817
- ?
1918

@@ -82,6 +81,47 @@ sql, param, _ := jql.Generate()
8281
db.Query(sql, param)
8382
```
8483

84+
## Example Union Query Operation
85+
86+
```json
87+
[
88+
{
89+
"table": "table_1",
90+
"selectFields": ["a", "b"],
91+
"conditions": [
92+
{
93+
"datatype": "number",
94+
"clause": "a",
95+
"operator": "=",
96+
"value": 1
97+
}
98+
],
99+
"limit": 1
100+
},
101+
{
102+
"table": "table_2",
103+
"selectFields": ["a", "b"],
104+
"conditions": [
105+
{
106+
"datatype": "number",
107+
"clause": "a",
108+
"operator": "=",
109+
"value": 1
110+
}
111+
],
112+
"limit": 1
113+
}
114+
]
115+
```
116+
117+
Output:
118+
119+
```
120+
SELECT a, b FROM table_1 WHERE a = 1 LIMIT 1 UNION SELECT a, b FROM table_2 WHERE a = 1 LIMIT 1
121+
```
122+
123+
You can see the difference between a union query and a standard select. In a union, you must use a JSON array with the standard JSON format as before.
124+
85125
## Operator Lists
86126

87127
```go

0 commit comments

Comments
 (0)