Skip to content

Commit

Permalink
更新README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotodian committed May 28, 2021
1 parent de8984a commit c66687d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Gorm Generator
## 声明: 该项目为根据结构题生成orm操作
## 只支持go 1.16版本以后
## 请使用gorm v2
## 只支持go mod
声明: 该项目为根据结构体生成orm操作并只支持go 1.16版本以后其次请使用gorm v2并且只支持go mod

下载项目:

`go get github.com/Kotodian/gorm-gen`

使用:

`gorm-gen --dir=<项目结构体路径> --output=<生成文件路径>`

结构体example:

```go
type User struct {
Name string `gorm:"column:name" query:"equal,scope"`
Age int `gorm:"column:age" query:"scope"`
}
```

结构体中的字段的tag中必须包含gorm,其次,query代表生成新的查询,equal代表Where("field = ?", xxx), scope代表范围查询 >=, <=

TODO:

​ 关联结构体生成orm

0 comments on commit c66687d

Please sign in to comment.