Gendao is generate DAO and Model source code using templates.
go get github.com/suzujun/gendao
Gendao provides these commands.
init
- Create initialized JSON filepull
- Generate JSON of table struct from databaseaddtype
- Set your own type for the column in the tablegen
- Generate Dao and Model from json schema
# Setting the database information
$ gendao init -d database_name > config.json
# Generate JSON schema for table
$ gendao pull config.json
# Generate source code
$ gendao gen config.json -t tablename1,tablename2
Create initialized JSON file.
host
orH
- host name to connect to the database (localhost
by default)port
orP
- port to connect to the database (3306
by default)user
oru
- user name to connect to the database (root
by default)password
orp
- password to connect to the database (empty value by default)database
ord
- database to be processed (The value of the config is used as the default)
Generate a JSON of table struct. This command has these flag options.
database
- database to be processed (The value of the config is used as the default)
Set your own type for the column in the table. Follow the wizard and enter necessary items.
Generate a source code. This command has these flag options.
database
- database to be processed (The value of the config is used as the default)table
- tables to be processed (select all by default)
MIT