update input param

This commit is contained in:
2024-08-23 10:59:20 +08:00
parent c586fa5c4f
commit 21ad50b273
2 changed files with 22 additions and 6 deletions

View File

@ -14,6 +14,7 @@ import (
"git.zhangdeman.cn/zhangdeman/database/abstract"
"git.zhangdeman.cn/zhangdeman/database/define"
"git.zhangdeman.cn/zhangdeman/wrapper"
"strings"
)
var (
@ -39,6 +40,9 @@ func (e *execute) SetDatabaseClientManager(databaseClientManager abstract.IWrapp
//
// Date : 20:48 2024/8/21
func (e *execute) Run(ctx context.Context, inputParam *define.Api2SqlParam) (any, error) {
if err := e.formatAndValidateInputParam(inputParam); nil != err {
return nil, err
}
if len(inputParam.InputSql) > 0 {
// 基于表达式执行
return e.Express(ctx, inputParam)
@ -68,6 +72,17 @@ func (e *execute) Run(ctx context.Context, inputParam *define.Api2SqlParam) (any
//
// Date : 20:52 2024/8/21
func (e *execute) List(ctx context.Context, inputParam *define.Api2SqlParam) (any, error) {
replaceTable := map[string]string{
"{FIELD_LIST}": "`" + strings.Join(inputParam.ColumnList, "` , `"),
"{TABLE}": inputParam.Table,
}
sqlTplList := []string{
define.SqlSelectBaseTpl,
}
if len(inputParam.ValueList) > 0 {
// where 条件
sqlTplList = append(sqlTplList, define.SqlWhereTpl)
}
return nil, nil
}