mysql/postgresql database to golang struct for gorm model
go install github.com/dxc0522/sql2struct@latest
# 直接执行
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"
- mysql
- postgreSQL