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.
user
- user name to connect to the database (root
by default)password
- password to connect to the database (empty value by default)database
- 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