Skip to content

idoubi/sql2struct

Repository files navigation

sql2struct

SQL2Struct is a developer-friendly tool used for transfering sql statement to go struct.

中文说明

use sql2struct online

click to visit the sql2struct online website

use sql2struct as chrome extension

  1. install from source
git clone https://github.com/idoubi/sql2struct.git
cd sql2struct
pnpm install
  1. build chrome extension
pnpm build:chrome
  1. install chrome extension

open chrome://extensions/

load extension from sql2struct project dir dist/chrome

use sql2struct locally

  1. install from source
git clone https://github.com/idoubi/sql2struct.git
cd sql2struct
pnpm install
  1. preview
pnpm dev
  1. build
pnpm build

# or

pnpm build:web

how to use

  1. execute show create table xxx\G; in your database client.

20220626221324

  1. paste sql statement in the left editor.

20220626222145

and you'll see the go struct code in the right editor transfered from the sql statement you pasted.

  1. 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. =[]

20220626222618

and you can click "options" button to modify other transfer options.

fields in "special identifiers" will be uppercased when transfered to go struct fields.

20220626222854

"field maps" defines the map rules between sql field type and go struct field type.

20220626222912

something else

stars and issues are all be appreciated.

you can contact me by email to me@idoubi.cc.