@@ -28,7 +28,7 @@ func TestSimpleQuery(t *testing.T) {
28
28
29
29
rawQuery := []byte (`{"selector":{"owner":{"$eq":"jerry"}},"limit": 10,"skip": 0}` )
30
30
31
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
31
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
32
32
33
33
//There should be one wrapped field
34
34
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" data.owner\" " ), 1 )
@@ -46,7 +46,7 @@ func TestQueryWithOperator(t *testing.T) {
46
46
47
47
rawQuery := []byte (`{"selector":{"$or":[{"owner":{"$eq":"jerry"}},{"owner": {"$eq": "frank"}}]},"limit": 10,"skip": 0}` )
48
48
49
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
49
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
50
50
51
51
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" data.owner\" " ), 2 )
52
52
@@ -66,7 +66,7 @@ func TestQueryWithImplicitOperatorAndExplicitOperator(t *testing.T) {
66
66
67
67
rawQuery := []byte (`{"selector":{"color":"green","$or":[{"owner":"fred"},{"owner":"mary"}]}}` )
68
68
69
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
69
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
70
70
71
71
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" data.owner\" " ), 2 )
72
72
@@ -88,7 +88,7 @@ func TestQueryWithFields(t *testing.T) {
88
88
89
89
rawQuery := []byte (`{"selector":{"owner": {"$eq": "tom"}},"fields": ["owner", "asset_name", "color", "size"], "limit": 10, "skip": 0}` )
90
90
91
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
91
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
92
92
93
93
//$eq operator should be unchanged
94
94
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $eq\" " ), 1 )
@@ -112,7 +112,7 @@ func TestQueryWithSortFields(t *testing.T) {
112
112
113
113
rawQuery := []byte (`{"selector":{"owner": {"$eq": "tom"}},"fields": ["owner", "asset_name", "color", "size"], "sort": ["size", "color"], "limit": 10, "skip": 0}` )
114
114
115
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
115
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
116
116
117
117
//$eq operator should be unchanged
118
118
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $eq\" " ), 1 )
@@ -136,7 +136,7 @@ func TestQueryWithSortObjects(t *testing.T) {
136
136
137
137
rawQuery := []byte (`{"selector":{"owner": {"$eq": "tom"}},"fields": ["owner", "asset_name", "color", "size"], "sort": [{"size": "desc"}, {"color": "desc"}], "limit": 10, "skip": 0}` )
138
138
139
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
139
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
140
140
141
141
//$eq operator should be unchanged
142
142
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $eq\" " ), 1 )
@@ -173,7 +173,7 @@ func TestQueryLeadingOperator(t *testing.T) {
173
173
}
174
174
}` )
175
175
176
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
176
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
177
177
178
178
//$and operator should be unchanged
179
179
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $and\" " ), 1 )
@@ -200,7 +200,7 @@ func TestQueryLeadingAndEmbeddedOperator(t *testing.T) {
200
200
]
201
201
}}` )
202
202
203
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
203
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
204
204
205
205
//$and operator should be unchanged
206
206
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $and\" " ), 1 )
@@ -242,7 +242,7 @@ func TestQueryEmbeddedOperatorAndArrayOfObjects(t *testing.T) {
242
242
}
243
243
}` )
244
244
245
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
245
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
246
246
247
247
//$and operator should be unchanged
248
248
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $and\" " ), 1 )
@@ -270,7 +270,7 @@ func TestQueryEmbeddedOperatorAndArrayOfValues(t *testing.T) {
270
270
}
271
271
}` )
272
272
273
- wrappedQuery := []byte (ApplyQueryWrapper (string (rawQuery )))
273
+ wrappedQuery := []byte (ApplyQueryWrapper ("ns1" , string (rawQuery )))
274
274
275
275
//$gt operator should be unchanged
276
276
testutil .AssertEquals (t , strings .Count (string (wrappedQuery ), "\" $gt\" " ), 1 )
0 commit comments