https://github.com/jrobles/mysql2json-go
Inspired by Arturom - Connects to a MySQL database and prints JSON formatted records
https://github.com/jrobles/mysql2json-go
golang json mysql-database
Last synced: 4 months ago
JSON representation
Inspired by Arturom - Connects to a MySQL database and prints JSON formatted records
- Host: GitHub
- URL: https://github.com/jrobles/mysql2json-go
- Owner: jrobles
- License: apache-2.0
- Created: 2016-04-30T02:45:37.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-18T02:14:15.000Z (about 10 years ago)
- Last Synced: 2025-07-05T12:44:24.949Z (12 months ago)
- Topics: golang, json, mysql-database
- Language: Go
- Homepage: http://robi.ninja
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mysql2json-go
Inspired by [Arturom's](https://github.com/arturom) awesome [mysql2json](https://github.com/arturom/mysql2json) python script. Connects to a MySQL database and prints JSON formatted records to STDOUT...but using Golang!
### Use this:
```bash
./app -host=server -port=3306 -user=hello -password=hola -database=bonjour -query="SELECT * FROM products LIMIT 1"
```
### Turn this
```sql
SELECT * FROM products;
```
```
+----+----------------+-------------------+
| id | name | quantity |
+----+----------------+-------------------+
| 1 | TLR 22 3.0 | 1 |
+----+----------------+-------------------+
```
### Into this
```json
[{"id":"1","name":"TLR 22 3.0","quantity":"1"}]
```