Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dveeden/tidb-markdown-sql-format
Format SQL statements in Markdown for TiDB
https://github.com/dveeden/tidb-markdown-sql-format
Last synced: about 1 month ago
JSON representation
Format SQL statements in Markdown for TiDB
- Host: GitHub
- URL: https://github.com/dveeden/tidb-markdown-sql-format
- Owner: dveeden
- License: apache-2.0
- Created: 2024-01-19T10:22:48.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-01-19T10:27:51.000Z (10 months ago)
- Last Synced: 2024-01-19T11:54:07.644Z (10 months ago)
- Language: Go
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Building
```
go build
```# Testing
```
go test -v
```# Running
```
go build
./markdown-sql-format -filename test.md
diff -u test.md <(./markdown-sql-format -filename test.md 2> /dev/null)
```# Example
````
$ diff -u test.md <(./markdown-sql-format -filename test.md 2> /dev/null)
--- test.md 2024-01-19 09:48:08.396747750 +0100
+++ /dev/fd/63 2024-01-19 11:25:24.462083985 +0100
@@ -9,33 +9,33 @@
Example 2:
```sql
-SeLeCt 2;
+SELECT 2;
```
Example 3:
```sql
-mysql> SeLeCt 3;
+mysql> SELECT 3;
```
Example 4:
```sql
-SeLeCt 1 Union aLL Select 4;
+SELECT 1 UNION ALL SELECT 4;
```
Example 5:
```sql
-INSERT INTO t(c) VALUES (1);
-iNSERT INTO t(c) VALUES (2);
-InSERT INTO t(c) VALUES (3), (4), (5);
+INSERT INTO `t` (`c`) VALUES (1);
+INSERT INTO `t` (`c`) VALUES (2);
+INSERT INTO `t` (`c`) VALUES (3),(4),(5);
```
Example 6:
```sql
-mysql> SelECT * FROM t;
+mysql> SELECT * FROM `t`;
+----+---+
| id | c |
+----+---+
@@ -46,4 +46,4 @@
| 5 | 5 |
+----+---+
5 rows in set (0.01 sec)
-```
\ No newline at end of file
+```
````