查询条件支持覆盖默认表名

This commit is contained in:
2023-03-22 21:02:24 +08:00
parent 5808a650dd
commit f2a4e10eb2
2 changed files with 25 additions and 8 deletions

View File

@ -30,6 +30,7 @@ type ORCondition struct {
//
// Date : 8:05 下午 2021/8/8
type Option struct {
Table string `json:"table"` // 查询的数据表
Limit int `json:"limit"` // 限制数量
Offset int `json:"offset"` // 偏移量
In map[string]interface{} `json:"in"` // in语句
@ -44,6 +45,17 @@ type Option struct {
OR []*ORCondition `json:"or"` // or 语句, or 和其他属性 and 关系, 内部 OR 关系
}
// WithTable 设置查询的表名
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 20:56 2023/3/22
func WithTable(tableName string) SetOption {
return func(o *Option) {
o.Table = tableName
}
}
// WithWhere 设置where条件
//
// Author : go_developer@163.com<白茶清欢>