SQL2Struct is a developer-friendly tool used for transfering sql statement to go struct.
click to visit the sql2struct online website
- clone source code
git clone https://github.com/idoubi/sql2struct.git
- install
cd sql2struct
pnpm install
- preview
pnpm run dev
- build
pnpm run build
- execute
show create table xxx\G;
in your database client.
- paste sql statement in the left editor.
and you'll see the go struct code in the right editor transfered from the sql statement you pasted.
- change the transfer options.
by default, only json tags will be used in transfered go struct code. you can click other checkboxes to add more tags. =[]
and you can click "options" button to modify other transfer options.
fields in "special identifiers" will be uppercased when transfered to go struct fields.
"field maps" defines the map rules between sql field type and go struct field type.
stars and issues are all be appreciated.
you can contact me by email to me@idoubi.cc.