Skip to content

This is an open source tool convert mysql table structure to golang`s struct and written by pure golang.

License

Notifications You must be signed in to change notification settings

CaiJinKen/gostruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gostruct

This is an open source tool convert mysql table structure to golang`s struct and written by pure golang.

Install:

go get github.com/CaiJinKen/gostruct

Usage:

  • get struct from sql file
gostruct -i users.sql -o users.go
  • get struct from db connection
gostruct -d `user:password@tcp(host:port)/db_name` -t users -o ./models/users.go

This tool also can:

  • generate json tag(default) and gorm tag
  • print the struct(default)
  • sort struct fields

Help:

gostruct --help

or

gostruct -h

About

This is an open source tool convert mysql table structure to golang`s struct and written by pure golang.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages