Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 733 Bytes

README.md

File metadata and controls

26 lines (21 loc) · 733 Bytes

mysql2json-go

Inspired by Arturom's awesome mysql2json python script. Connects to a MySQL database and prints JSON formatted records to STDOUT...but using Golang!

Use this:

./app -host=server -port=3306 -user=hello -password=hola -database=bonjour -query="SELECT * FROM products LIMIT 1"

Turn this

SELECT * FROM products;
+----+----------------+-------------------+
| id | name           | quantity          |
+----+----------------+-------------------+
|  1 | TLR 22 3.0     |                 1 |
+----+----------------+-------------------+

Into this

[{"id":"1","name":"TLR 22 3.0","quantity":"1"}]