This commit is contained in:
2024-08-23 18:17:31 +08:00
parent c6b8d29b61
commit 2be1b29234
3 changed files with 38 additions and 2 deletions

View File

@ -8,6 +8,9 @@
package api2sql
import (
"context"
"fmt"
"git.zhangdeman.cn/zhangdeman/consts"
"git.zhangdeman.cn/zhangdeman/database"
"git.zhangdeman.cn/zhangdeman/database/define"
"testing"
@ -27,5 +30,35 @@ func Test_execute_Run(t *testing.T) {
}, []string{}); nil != err {
panic(err.Error())
}
dbClient, _ := clientManager.GetDBClient("TEST_DATABASE")
dbClient.SetTableStructure(map[string][]*define.ColumnConfig{
"project": []*define.ColumnConfig{
&define.ColumnConfig{
Column: "flag",
Alias: "project_flag",
Type: "string",
},
},
})
Exec.SetDatabaseClientManager(clientManager)
res, err := Exec.List(context.Background(), &define.Api2SqlParam{
DatabaseFlag: "TEST_DATABASE",
Table: "project",
ForceMaster: false,
InputSql: "",
TableSplitConfig: define.TableSplitConfig{},
SqlType: consts.SqlTypeList,
ColumnList: nil,
Limit: 0,
Offset: 0,
ForceNoLimit: false,
OrderField: "id",
OrderRule: "desc",
WithCount: false,
ConditionList: nil,
TableColumnConfig: nil,
Tx: nil,
})
fmt.Println(res, err)
}