test(qb): Add tests for qb section (#74)
test(qb): Add missing tests for qb directory * Add a GROUP BY test without Columns * Add LtFunc test * Add LtOrEqFunc test * Add GtFunc test * Add GtOrEqFunc test * Add a Select with a AS between one column test * Add a Order By DESC test * Add Sum test * Add Avg test * Add Max test * Add 2 tests for FuncColumn * Add SetNamed test * Add AddFunc test * Add RemoveFunc test * Add TTL and TimestampNamed test * Add TTLNamed and Timestamp test * Add TTL with negative or no duration test * Add LtFunc test * Add LtOrEqFunc test * Add GtFunc test * Add GtOrEqFunc test * Add a Select with a AS between one column test * Add a Order By DESC test * Add Sum test * Add Avg test * Add Max test * Add SetNamed test * Add AddFunc test * Add RemoveFunc test * Add TTL and TimestampNamed test * Add TTLNamed and Timestamp test * Add TTL with negative or no duration test * Add LtFunc test * Add LtOrEqFunc test * Add GtFunc test * Add GtOrEqFunc test * Add a Select with a AS between one column test * Add a Order By DESC test * Add Sum test * Add Avg test * Add Max test * Add 2 tests for FuncColumn * Add SetNamed test * Add AddFunc test * Add RemoveFunc test * In qb/select.go, if there are no colums and the query have a GroupBy statement then the query will be malformated. * In qb/utils.go, refactor writeCql with a strings.Join call. Fixes #78
This commit is contained in:
committed by
Michal Matczuk
parent
dcec9d031f
commit
87976451ed
@@ -125,6 +125,24 @@ func TestUpdateBuilder(t *testing.T) {
|
||||
S: "UPDATE cycling.cyclist_name SET id=?,user_uuid=?,firstname=? WHERE id=? IF EXISTS ",
|
||||
N: []string{"id", "user_uuid", "firstname", "expr"},
|
||||
},
|
||||
// Add SET column
|
||||
{
|
||||
B: Update("cycling.cyclist_name").SetNamed("firstname", "name"),
|
||||
S: "UPDATE cycling.cyclist_name SET firstname=? ",
|
||||
N: []string{"name"},
|
||||
},
|
||||
// Add AddFunc
|
||||
{
|
||||
B: Update("cycling.cyclist_name").AddFunc("timestamp", Now()),
|
||||
S: "UPDATE cycling.cyclist_name SET timestamp=timestamp+now() ",
|
||||
N: nil,
|
||||
},
|
||||
// Add RemoveFunc
|
||||
{
|
||||
B: Update("cycling.cyclist_name").RemoveFunc("timestamp", Now()),
|
||||
S: "UPDATE cycling.cyclist_name SET timestamp=timestamp-now() ",
|
||||
N: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range table {
|
||||
|
||||
Reference in New Issue
Block a user