Skip to content

Commit

Permalink
feat: update README.md and README.ZH_CN.md (go-gorm#548)
Browse files Browse the repository at this point in the history
* feat: update README.md and README.ZH_CN.md

* feat: update README.md and README.ZH_CN.md

* feat: update README.md and README.ZH_CN.md
  • Loading branch information
StellarisW authored Jul 15, 2022
1 parent a71f0ec commit 18f8dcd
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
34 changes: 34 additions & 0 deletions README.ZH_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,8 @@ go install gorm.io/gen/tools/gentool@latest
```bash
$ gentool -h
Usage of gentool:
-c string
is path for gen.yml
-db string
input mysql or postgres or sqlite or sqlserver. consult[https://gorm.io/docs/connecting_to_the_database.html] (default "mysql")
-dsn string
Expand Down Expand Up @@ -2121,6 +2123,38 @@ Usage of gentool:
``` bash
gentool -dsn "user:pwd@tcp(127.0.0.1:3306)/database?charset=utf8mb4&parseTime=True&loc=Local" -tables "orders,doctor"
gentool -c "./gen.yml"
```
配置文件示例:
config example:
```
version: "0.1"
database:
# consult[https://gorm.io/docs/connecting_to_the_database.html]"
dsn : "username:password@tcp(address:port)/db?charset=utf8mb4&parseTime=true&loc=Local"
# input mysql or postgres or sqlite or sqlserver. consult[https://gorm.io/docs/connecting_to_the_database.html]
db : "mysql"
# enter the required data table or leave it blank.You can input : orders,users,goods
tables : "user"
# specify a directory for output
outPath : "./dao/query"
# query code file name, default: gen.go
outFile : ""
# generate unit test for query code
withUnitTest : false
# generated model code's package name
modelPkgName : ""
# generate with pointer when field is nullable
fieldNullable : false
# generate field with gorm index tag
fieldWithIndexTag : false
# generate field with gorm column type tag
fieldWithTypeTag : false

```

## <span id="maintainers">维护者</span>
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,8 @@ usage:
```bash
$ gentool -h
Usage of gentool:
-c string
is path for gen.yml
-db string
input mysql or postgres or sqlite or sqlserver. consult[https://gorm.io/docs/connecting_to_the_database.html] (default "mysql")
-dsn string
Expand Down Expand Up @@ -2112,6 +2114,35 @@ example:
``` bash
gentool -dsn "user:pwd@tcp(127.0.0.1:3306)/database?charset=utf8mb4&parseTime=True&loc=Local" -tables "orders,doctor"
gentool -c "./gen.yml"
```
config example:
```
version: "0.1"
database:
# consult[https://gorm.io/docs/connecting_to_the_database.html]"
dsn : "username:password@tcp(address:port)/db?charset=utf8mb4&parseTime=true&loc=Local"
# input mysql or postgres or sqlite or sqlserver. consult[https://gorm.io/docs/connecting_to_the_database.html]
db : "mysql"
# enter the required data table or leave it blank.You can input : orders,users,goods
tables : "user"
# specify a directory for output
outPath : "./dao/query"
# query code file name, default: gen.go
outFile : ""
# generate unit test for query code
withUnitTest : false
# generated model code's package name
modelPkgName : ""
# generate with pointer when field is nullable
fieldNullable : false
# generate field with gorm index tag
fieldWithIndexTag : false
# generate field with gorm column type tag
fieldWithTypeTag : false

```

## Maintainers
Expand Down

0 comments on commit 18f8dcd

Please sign in to comment.