增加 sql 模板定义
This commit is contained in:
parent
a4d887ecb1
commit
c586fa5c4f
@ -23,7 +23,7 @@ package define
|
||||
//
|
||||
// delete 语句 : DELETE FROM {TABLE} WHERE {WHERE} LIMIT {LIMIT} OFFSET {OFFSET} ORDER BY {ORDER_FIELD} {ORDER_RULE}
|
||||
//
|
||||
// count 语句 : SELECT COUNT(*) FROM {TABLE} WHERE {WHERE}
|
||||
// count 语句 : SELECT COUNT(*) as count FROM {TABLE} WHERE {WHERE}
|
||||
type Api2SqlParam struct {
|
||||
DatabaseFlag string `json:"database_flag"` // 数据库标识
|
||||
Table string `json:"table"` // 操作的数据表
|
||||
@ -56,3 +56,15 @@ type Api2SqlParamValue struct {
|
||||
Default any `json:"-"` // 默认值 TODO : 配置默认值生成策略
|
||||
DataMask any `json:"-"` // 数据脱敏策略
|
||||
}
|
||||
|
||||
const (
|
||||
SqlSelectBaseTpl = `SELECT {FIELD_LIST} FROM {TABLE}` // select 语句基础模板
|
||||
SqlInsertBaseTpl = `INSERT INTO {TABLE} ({FIELD_LIST}) VALUES ({VALUE_LIST})` // Insert语句基础模板
|
||||
SqlUpdateBaseTpl = `UPDATE {TABLE} SET {SET}` // Update语句基础模板
|
||||
SqlDeleteBaseTpl = `DELETE FROM {TABLE}` // Delete语句基础模板
|
||||
SqlCountBaseTpl = `SELECT COUNT(*) as count FROM {TABLE}` // Count语句基础模板
|
||||
SqlWhereTpl = "WHERE {WHERE}" // where 语句
|
||||
SqlOrder = "ORDER BY {ORDER_FIELD} {ORDER_RULE}" // 排序语句
|
||||
SqlLimit = "LIMIT {LIMIT}" // limit 语句
|
||||
SqlOffset = "OFFSET {OFFSET}" // offset 语句
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user