Skip to content

AAkira/gendao

 
 

Repository files navigation

Gendao

CircleCI Build Status Coverage Status Code Climate codecov

Gendao is generate DAO and Model source code using templates.

Install

go get github.com/suzujun/gendao

Usage

Gendao provides these commands.

  • init - Create initialized JSON file
  • pull - Generate JSON of table struct from database
  • addtype - Set your own type for the column in the table
  • gen - Generate Dao and Model from json schema

Example

# 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

gendao commands

gendao init

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)

gendao pull [config name]

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)

gendao addtype [config name]

Set your own type for the column in the table. Follow the wizard and enter necessary items.

gendao gen [config name]

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)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 85.6%
  • Smarty 13.8%
  • Other 0.6%