fix NPE
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user