增加数据详情查询能力
This commit is contained in:
@ -18,7 +18,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_execute_Run(t *testing.T) {
|
||||
func startTest() {
|
||||
clientManager := database.NewWrapperClient()
|
||||
if err := clientManager.AddWithConfig("TEST_DATABASE", nil, &define.Database{
|
||||
Master: &define.Driver{
|
||||
@ -44,6 +44,10 @@ func Test_execute_Run(t *testing.T) {
|
||||
},
|
||||
})
|
||||
Exec.SetDatabaseClientManager(clientManager)
|
||||
}
|
||||
|
||||
func Test_execute_List(t *testing.T) {
|
||||
startTest()
|
||||
res, err := Exec.List(context.Background(), &define.Api2SqlParam{
|
||||
DatabaseFlag: "TEST_DATABASE",
|
||||
Table: "project",
|
||||
@ -57,6 +61,47 @@ func Test_execute_Run(t *testing.T) {
|
||||
Alias: "project_flag",
|
||||
Type: "string",
|
||||
},
|
||||
&define.ColumnConfig{
|
||||
Column: "connect_timeout",
|
||||
Alias: "timeout",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Limit: 0,
|
||||
Offset: 0,
|
||||
ForceNoLimit: false,
|
||||
OrderField: "id",
|
||||
OrderRule: "desc",
|
||||
WithCount: false,
|
||||
ConditionList: nil,
|
||||
TableColumnConfig: nil,
|
||||
Tx: nil,
|
||||
})
|
||||
byteData, _ := json.Marshal(res)
|
||||
tt := reflect.TypeOf(res)
|
||||
fmt.Println(tt.String(), res, err, string(byteData))
|
||||
}
|
||||
|
||||
func Test_execute_Detail(t *testing.T) {
|
||||
startTest()
|
||||
res, err := Exec.Detail(context.Background(), &define.Api2SqlParam{
|
||||
DatabaseFlag: "TEST_DATABASE",
|
||||
Table: "project",
|
||||
ForceMaster: false,
|
||||
InputSql: "",
|
||||
TableSplitConfig: define.TableSplitConfig{},
|
||||
SqlType: consts.SqlTypeList,
|
||||
ColumnList: []*define.ColumnConfig{
|
||||
&define.ColumnConfig{
|
||||
Column: "flag",
|
||||
Alias: "project_flag",
|
||||
Type: "string",
|
||||
},
|
||||
&define.ColumnConfig{
|
||||
Column: "description",
|
||||
Alias: "desc",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Limit: 0,
|
||||
Offset: 0,
|
||||
|
Reference in New Issue
Block a user