|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"git.sxidc.com/service-supports/dps-sdk"
|
|
|
"git.sxidc.com/service-supports/dps-sdk/ports"
|
|
|
+ "github.com/stretchr/testify/assert"
|
|
|
"testing"
|
|
|
)
|
|
|
|
|
|
@@ -76,3 +77,100 @@ func (toolKit *ToolKit) update(req *ports.UpdateRequest) *ToolKit {
|
|
|
|
|
|
return toolKit
|
|
|
}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) queryByWhereAndOrderBy(req *ports.QueryByWhereAndOrderByRequest, retInfosMap *[]map[string]any) *ToolKit {
|
|
|
+ statement, infosMap, totalCount, err := clientInstance.QueryByWhereAndOrderBy(req)
|
|
|
+ if err != nil {
|
|
|
+ toolKit.t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ toolKit.assertEqual(len(infosMap), int(totalCount), "总数不一致")
|
|
|
+
|
|
|
+ fmt.Println(statement)
|
|
|
+
|
|
|
+ if retInfosMap != nil {
|
|
|
+ *retInfosMap = make([]map[string]any, 0)
|
|
|
+ *retInfosMap = infosMap
|
|
|
+ }
|
|
|
+
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) commonQuery(req *ports.CommonQueryRequest, retInfosMap *[]map[string]any) *ToolKit {
|
|
|
+ statement, infosMap, totalCount, err := clientInstance.CommonQuery(req)
|
|
|
+ if err != nil {
|
|
|
+ toolKit.t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ toolKit.assertEqual(len(infosMap), int(totalCount), "总数不一致")
|
|
|
+
|
|
|
+ fmt.Println(statement)
|
|
|
+
|
|
|
+ if retInfosMap != nil {
|
|
|
+ *retInfosMap = make([]map[string]any, 0)
|
|
|
+ *retInfosMap = infosMap
|
|
|
+ }
|
|
|
+
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) commonQueryByKeys(req *ports.CommonQueryByKeysRequest, retInfoMap *map[string]any) *ToolKit {
|
|
|
+ statement, infoMap, err := clientInstance.CommonQueryByKeys(req)
|
|
|
+ if err != nil {
|
|
|
+ toolKit.t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println(statement)
|
|
|
+
|
|
|
+ if retInfoMap != nil {
|
|
|
+ *retInfoMap = make(map[string]any)
|
|
|
+ *retInfoMap = infoMap
|
|
|
+ }
|
|
|
+
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) CountWhere(req *ports.CountWhereRequest, retCount *int64) *ToolKit {
|
|
|
+ statement, count, err := clientInstance.CountWhere(req)
|
|
|
+ if err != nil {
|
|
|
+ toolKit.t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println(statement)
|
|
|
+
|
|
|
+ if retCount != nil {
|
|
|
+ *retCount = count
|
|
|
+ }
|
|
|
+
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) CommonCount(req *ports.CommonCountRequest, retCount *int64) *ToolKit {
|
|
|
+ statement, count, err := clientInstance.CommonCount(req)
|
|
|
+ if err != nil {
|
|
|
+ toolKit.t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ fmt.Println(statement)
|
|
|
+
|
|
|
+ if retCount != nil {
|
|
|
+ *retCount = count
|
|
|
+ }
|
|
|
+
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) assertEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) *ToolKit {
|
|
|
+ assert.Equal(toolKit.t, expected, actual, msgAndArgs)
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) assertNotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) *ToolKit {
|
|
|
+ assert.NotEqual(toolKit.t, expected, actual, msgAndArgs)
|
|
|
+ return toolKit
|
|
|
+}
|
|
|
+
|
|
|
+func (toolKit *ToolKit) assertNotEmpty(object interface{}, msgAndArgs ...interface{}) *ToolKit {
|
|
|
+ assert.NotEmpty(toolKit.t, object, msgAndArgs)
|
|
|
+ return toolKit
|
|
|
+}
|