修复代码BUG + 循环引用

This commit is contained in:
2024-08-23 17:54:48 +08:00
parent f359598109
commit c6b8d29b61
9 changed files with 154 additions and 115 deletions

View File

@ -43,7 +43,7 @@ type Api2SqlParam struct {
OrderRule string `json:"order_rule"` // 排序规则, Asc / Desc
WithCount bool `json:"with_count"` // 是否返回数据总量, 仅 sqlType = list 生效
ConditionList []SqlCondition `json:"value_list"` // 字段列表
TableColumnConfig []*ColumnInfo `json:"table_column_config"` // 表字段配置
TableColumnConfig []*ColumnConfig `json:"table_column_config"` // 表字段配置
Tx *gorm.DB `json:"-"` // 前后已有的数据库连接, 直接复用
}

39
define/sql_option.go Normal file
View File

@ -0,0 +1,39 @@
// 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 关系
}