sql2json

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 10 Imported by: 0

README

sql2json

sql database query result export to json lines

Install

go install -x github.com/myml/sql2json@latest

Command Args

  -db string
        database type, mysql,postgres,sqlite,sqlserver,clickhouse (default "mysql")
  -dns string
        see https://gorm.io/docs/connecting_to_the_database.html#SQLite
  -sql string
        select * from mysql
  -format
        output format json

Example

sql2json -db mysql -dns "user:password@tcp(127.0.0.1:3306)/mysql?charset=utf8mb4&parseTime=True&loc=Local" -sql "select * from user"

Output:

{"Alter_priv":"N","Alter_routine_priv":"N","Create_priv":"N","Create_routine_priv":"N","Create_tmp_table_priv":"N","Create_view_priv":"N","Db":"performance_schema","Delete_priv":"N","Drop_priv":"N","Event_priv":"N","Execute_priv":"N","Grant_priv":"N","Host":"localhost","Index_priv":"N","Insert_priv":"N","Lock_tables_priv":"N","References_priv":"N","Select_priv":"Y","Show_view_priv":"N","Trigger_priv":"N","Update_priv":"N","User":"mysql.session"}
{"Alter_priv":"N","Alter_routine_priv":"N","Create_priv":"N","Create_routine_priv":"N","Create_tmp_table_priv":"N","Create_view_priv":"N","Db":"sys","Delete_priv":"N","Drop_priv":"N","Event_priv":"N","Execute_priv":"N","Grant_priv":"N","Host":"localhost","Index_priv":"N","Insert_priv":"N","Lock_tables_priv":"N","References_priv":"N","Select_priv":"N","Show_view_priv":"N","Trigger_priv":"Y","Update_priv":"N","User":"mysql.sys"}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL