https://github.com/starfishs/sql2struct
sql2struct is a tool for sql statement to golang struct
https://github.com/starfishs/sql2struct
go golang gorm model mysql postgresql sql sql2struct struct tool xorm
Last synced: 2 months ago
JSON representation
sql2struct is a tool for sql statement to golang struct
- Host: GitHub
- URL: https://github.com/starfishs/sql2struct
- Owner: starfishs
- License: gpl-3.0
- Created: 2022-10-09T04:55:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-04T10:15:55.000Z (10 months ago)
- Last Synced: 2025-06-04T17:51:53.486Z (10 months ago)
- Topics: go, golang, gorm, model, mysql, postgresql, sql, sql2struct, struct, tool, xorm
- Language: Go
- Homepage:
- Size: 353 KB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://travis-ci.org/starfishs/sql2struct)
[](https://goreportcard.com/report/github.com/starfishs/sql2struct)
[](https://godoc.org/github.com/starfishs/sql2struct)
[](https://codecov.io/gh/starfishs/sql2struct)

# sql2struct
mysql/postgresql database to golang struct for gorm model
# install
```shell
go install github.com/starfishs/sql2struct@latest
```
# usage
```shell
sql2struct --dsn="mysql://root:123456@tcp(localhost:3306)/test?charset=utf8mb4"
```
# docker
```shell
docker run -v /path/to/store:/workspace -w /workspace starfishsfive/sql2struct:v1.0.0 --dsn="postgresql://root:123456@localhost:5432/test?sslmode=disable"
```
# support
- [x] mysql
- [x] postgreSQL
## Contributors