|
@@ -157,9 +157,7 @@ func TestTransaction(t *testing.T) {
|
|
|
countWhere(&client.CountWhereRequest{
|
|
countWhere(&client.CountWhereRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ?": {id},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().Equal("id", id),
|
|
|
}, &count).
|
|
}, &count).
|
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
|
}
|
|
}
|
|
@@ -264,17 +262,13 @@ func TestTransactionBatch(t *testing.T) {
|
|
|
countWhere(&client.CountWhereRequest{
|
|
countWhere(&client.CountWhereRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ?": {id1},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().Equal("id", id1),
|
|
|
}, &count).
|
|
}, &count).
|
|
|
assertEqual(int64(0), count, "数量不一致").
|
|
assertEqual(int64(0), count, "数量不一致").
|
|
|
countWhere(&client.CountWhereRequest{
|
|
countWhere(&client.CountWhereRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ?": {id2},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().Equal("id", id2),
|
|
|
}, &count).
|
|
}, &count).
|
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
|
}
|
|
}
|
|
@@ -324,17 +318,16 @@ func TestInsert(t *testing.T) {
|
|
|
checkExistWhere(&client.CountWhereRequest{
|
|
checkExistWhere(&client.CountWhereRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ?": {id},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().Equal("id", id),
|
|
|
}, &exist).
|
|
}, &exist).
|
|
|
assertEqual(true, exist, "存在状态不一致").
|
|
assertEqual(true, exist, "存在状态不一致").
|
|
|
commonCheckExist(&client.CommonCountRequest{
|
|
commonCheckExist(&client.CommonCountRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ? AND name = ? AND table_num = ?": {id, name, tableNum},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().
|
|
|
|
|
+ Equal("id", id).
|
|
|
|
|
+ Equal("name", name).
|
|
|
|
|
+ Equal("table_num", tableNum),
|
|
|
}, &exist).
|
|
}, &exist).
|
|
|
assertEqual(true, exist, "存在状态不一致")
|
|
assertEqual(true, exist, "存在状态不一致")
|
|
|
}
|
|
}
|
|
@@ -390,9 +383,10 @@ func TestInsertBatch(t *testing.T) {
|
|
|
queryByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
|
|
queryByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ? AND name = ? AND table_num = ?": {id1, name1, tableNum1},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().
|
|
|
|
|
+ Equal("id", id1).
|
|
|
|
|
+ Equal("name", name1).
|
|
|
|
|
+ Equal("table_num", tableNum1),
|
|
|
PageNo: 1,
|
|
PageNo: 1,
|
|
|
PageSize: 1,
|
|
PageSize: 1,
|
|
|
}, &resultTableRows, &totalCount).
|
|
}, &resultTableRows, &totalCount).
|
|
@@ -404,9 +398,10 @@ func TestInsertBatch(t *testing.T) {
|
|
|
commonQuery(&client.CommonQueryRequest{
|
|
commonQuery(&client.CommonQueryRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ? AND name = ? AND table_num = ?": {id2, name2, tableNum2},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().
|
|
|
|
|
+ Equal("id", id2).
|
|
|
|
|
+ Equal("name", name2).
|
|
|
|
|
+ Equal("table_num", tableNum2),
|
|
|
PageNo: 1,
|
|
PageNo: 1,
|
|
|
PageSize: 1,
|
|
PageSize: 1,
|
|
|
}, &resultTableRows, &totalCount).
|
|
}, &resultTableRows, &totalCount).
|
|
@@ -418,9 +413,10 @@ func TestInsertBatch(t *testing.T) {
|
|
|
queryOnlyByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
|
|
queryOnlyByWhereAndOrderBy(&client.QueryByWhereAndOrderByRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ? AND name = ? AND table_num = ?": {id1, name1, tableNum1},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().
|
|
|
|
|
+ Equal("id", id1).
|
|
|
|
|
+ Equal("name", name1).
|
|
|
|
|
+ Equal("table_num", tableNum1),
|
|
|
PageNo: 1,
|
|
PageNo: 1,
|
|
|
PageSize: 1,
|
|
PageSize: 1,
|
|
|
}, &resultTableRows).
|
|
}, &resultTableRows).
|
|
@@ -431,9 +427,10 @@ func TestInsertBatch(t *testing.T) {
|
|
|
commonQueryOnly(&client.CommonQueryRequest{
|
|
commonQueryOnly(&client.CommonQueryRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ? AND name = ? AND table_num = ?": {id2, name2, tableNum2},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().
|
|
|
|
|
+ Equal("id", id2).
|
|
|
|
|
+ Equal("name", name2).
|
|
|
|
|
+ Equal("table_num", tableNum2),
|
|
|
PageNo: 1,
|
|
PageNo: 1,
|
|
|
PageSize: 1,
|
|
PageSize: 1,
|
|
|
}, &resultTableRows).
|
|
}, &resultTableRows).
|
|
@@ -541,9 +538,7 @@ func TestDelete(t *testing.T) {
|
|
|
countWhere(&client.CountWhereRequest{
|
|
countWhere(&client.CountWhereRequest{
|
|
|
TablePrefixWithSchema: tablePrefix,
|
|
TablePrefixWithSchema: tablePrefix,
|
|
|
Version: "v1",
|
|
Version: "v1",
|
|
|
- Where: map[string][]any{
|
|
|
|
|
- "id = ?": {id},
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ Where: client.NewClause().Equal("id", id),
|
|
|
}, &count).
|
|
}, &count).
|
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
assertEqual(int64(0), count, "数量不一致")
|
|
|
}
|
|
}
|