Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 813 Bytes

README.md

File metadata and controls

27 lines (22 loc) · 813 Bytes

Go Report Card GoDoc License

sql2struct

mysql/postgresql database to golang struct for gorm model

install

go install github.com/dxc0522/sql2struct@latest

usage

# 直接执行
sql2struct --dsn="mysql://root:123456@tcp(localhost:3306)/test?charset=utf8mb4"

# 读取文件执行
# 无dsn则自动读取./etc/config.yaml 文件下的
# DBConfig:
#  DSN: mysql://root:123456@tcp(localhost:3306)/test?charset=utf8mb4
sql2struct -t "user,to_do"

support

  • mysql
  • postgreSQL