gorm 支持model

This commit is contained in:
2024-01-15 15:20:27 +08:00
parent 1a63a89faf
commit f6bac5a5a0
4 changed files with 22 additions and 2 deletions

View File

@ -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<白茶清欢>