database/define/sql_option.go

40 lines
1.5 KiB
Go

// Package define ...
//
// Description : define ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-08-23 17:46
package define
// SetOption 设置选项
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 11:46 2022/5/15
type SetOption func(o *Option)
// Option 扩展选项
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 8:05 下午 2021/8/8
type Option struct {
Model any `json:"-"` // 操作model
Table string `json:"table"` // 查询的数据表
Limit int `json:"limit"` // 限制数量
Offset int `json:"offset"` // 偏移量
In map[string]any `json:"in"` // in语句
NotIn map[string]any `json:"not_in"` // not in语句
Where map[string]any `json:"where"` // where 条件
Between map[string][2]any `json:"between"` // between 条件
NotBetween map[string][2]any `json:"not_between"` // not between 条件
Start map[string]any `json:"start"` // >= 条件
End map[string]any `json:"end"` // < 条件
Like map[string]string `json:"like"` // like 语句
NotLike map[string]string `json:"not_like"` // not like 语句
NotEqual map[string]any `json:"not_equal"` // != 语句
Order []string `json:"order"` // 排序规则
OR [][]SetOption `json:"or"` // or 语句, or 和其他属性 and 关系, 内部 OR 关系
}