gorm 支持model
This commit is contained in:
12
option.go
12
option.go
@ -34,6 +34,7 @@ type ORCondition struct {
|
||||
//
|
||||
// Date : 8:05 下午 2021/8/8
|
||||
type Option struct {
|
||||
Model interface{} `json:"-"` // 操作model
|
||||
Table string `json:"table"` // 查询的数据表
|
||||
Limit int `json:"limit"` // 限制数量
|
||||
Offset int `json:"offset"` // 偏移量
|
||||
@ -49,6 +50,17 @@ type Option struct {
|
||||
OR []*ORCondition `json:"or"` // or 语句, or 和其他属性 and 关系, 内部 OR 关系
|
||||
}
|
||||
|
||||
// WithModel ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:18 2024/1/15
|
||||
func WithModel(model interface{}) SetOption {
|
||||
return func(o *Option) {
|
||||
o.Model = model
|
||||
}
|
||||
}
|
||||
|
||||
// WithTable 设置查询的表名
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
Reference in New Issue
Block a user