api2sql基础的能力 #8

Merged
zhangdeman merged 26 commits from feature/api2sql into master 2024-08-24 12:33:47 +08:00
Showing only changes of commit 4ee868a059 - Show all commits

36
define/api2sql.go Normal file
View File

@ -0,0 +1,36 @@
// Package define ...
//
// Description : define ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-08-21 16:05
package define
// Api2SqlParam 接口转sql的输入配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:06 2024/8/21
type Api2SqlParam struct {
TableSplit bool `json:"table_split"` // 是否分表
SplitField string `json:"split_field"` // 分表字段, 仅分表时有效, 分表字段要求在 ValueList 必须存在
SplitStrategy string `json:"split_strategy"` // 分表策略, 仅分表时有效, 支持注册自动以策略
SqlType string `json:"sql_type"` // sql语句类型 : detail - 查询详情 list - 查询列表 count - 查询数量 update - 更新 insert - 插入 delete - 删除
OrderField string `json:"order_field"` // 排序字段, 仅 sqlType = list 生效
OrderRule string `json:"order_rule"` // 排序规则, Asc / Desc
WithCount bool `json:"with_count"` // 是否返回数据总量, 仅 sqlType = list 生效
ValueList []*Api2SqlParamValue `json:"value_list"` // 字段列表
}
// Api2SqlParamValue ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 16:11 2024/8/21
type Api2SqlParamValue struct {
Field string `json:"field"` // 表字段
Value any `json:"value"` // 数据字段的值
Default any `json:"-"` // 默认值 TODO : 配置默认值生成策略
DataMask any `json:"-"` // 数据脱敏策略
}