SQL2Struct is a developer-friendly tool used for transfering sql statement to go struct.
click to visit the sql2struct online website
- install from source
git clone https://github.com/idoubi/sql2struct.git
cd sql2struct
pnpm install
- build chrome extension
pnpm build:chrome
- install chrome extension
open chrome://extensions/
load extension from sql2struct project dir dist/chrome
- install from source
git clone https://github.com/idoubi/sql2struct.git
cd sql2struct
pnpm install
- preview
pnpm dev
- build
pnpm build
# or
pnpm build:web
- 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.