@@ -28,35 +28,35 @@ describe('ModelMapper', () => {
28
28
mapperTestHelper . testParameters ( 'insert' ) ;
29
29
30
30
it ( 'should retrieve the table that apply and make a single execution' , ( ) => {
31
- const clientInfo = mapperTestHelper . getClient ( [ 'id1 ' , 'id2 ' , 'name' ] , [ 1 , 1 ] ) ;
31
+ const clientInfo = mapperTestHelper . getClient ( [ 'partition1 ' , 'clustering1 ' , 'name' ] , [ 1 , 1 ] ) ;
32
32
const modelMapper = mapperTestHelper . getModelMapper ( clientInfo ) ;
33
- const doc = { id2 : 'value2' , id1 : 'value1' } ;
33
+ const doc = { clustering1 : 'value2' , partition1 : 'value1' } ;
34
34
35
35
return modelMapper . insert ( doc )
36
36
. then ( ( ) => {
37
37
assert . strictEqual ( clientInfo . executions . length , 1 ) ;
38
38
const execution = clientInfo . executions [ 0 ] ;
39
- assert . strictEqual ( execution . query , 'INSERT INTO ks1.table1 ("id2 ", "id1 ") VALUES (?, ?)' ) ;
39
+ assert . strictEqual ( execution . query , 'INSERT INTO ks1.table1 ("clustering1 ", "partition1 ") VALUES (?, ?)' ) ;
40
40
assert . deepStrictEqual ( execution . params , Object . keys ( doc ) . map ( key => doc [ key ] ) ) ;
41
41
helper . assertProperties ( execution . options , { prepare : true , isIdempotent : true } ) ;
42
42
} ) ;
43
43
} ) ;
44
44
45
45
it ( 'should mark LWT queries as non-idempotent' , ( ) => testQueries ( 'insert' , [
46
46
{
47
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' } ,
47
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' } ,
48
48
docInfo : { ifNotExists : true } ,
49
- query : 'INSERT INTO ks1.table1 ("id2 ", "id1 ", "name") VALUES (?, ?, ?) IF NOT EXISTS' ,
49
+ query : 'INSERT INTO ks1.table1 ("clustering1 ", "partition1 ", "name") VALUES (?, ?, ?) IF NOT EXISTS' ,
50
50
params : [ 'value2' , 'value1' , 'name1' ] ,
51
51
isIdempotent : false
52
52
}
53
53
] ) ) ;
54
54
55
55
it ( 'should set TTL' , ( ) => testQueries ( 'insert' , [
56
56
{
57
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' } ,
57
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' } ,
58
58
docInfo : { ttl : 1000 } ,
59
- query : 'INSERT INTO ks1.table1 ("id2 ", "id1 ", "name") VALUES (?, ?, ?) USING TTL ?' ,
59
+ query : 'INSERT INTO ks1.table1 ("clustering1 ", "partition1 ", "name") VALUES (?, ?, ?) USING TTL ?' ,
60
60
params : [ 'value2' , 'value1' , 'name1' , 1000 ]
61
61
}
62
62
] ) ) ;
@@ -75,7 +75,7 @@ describe('ModelMapper', () => {
75
75
76
76
let catchCalled = false ;
77
77
78
- return modelMapper . insert ( { id1 : 'value1' } )
78
+ return modelMapper . insert ( { partition1 : 'value1' } )
79
79
. catch ( err => {
80
80
catchCalled = true ;
81
81
assert . strictEqual ( err , error ) ;
@@ -85,30 +85,30 @@ describe('ModelMapper', () => {
85
85
86
86
it ( 'should throw an error when filter or conditions are not valid' , ( ) => testErrors ( 'insert' , [
87
87
{
88
- doc : { id1 : 'x' , notAValidProp : 'y' } ,
89
- message : 'No table matches (all PKs have to be specified) fields: [id1 ,notAValidProp]'
88
+ doc : { partition1 : 'x' , notAValidProp : 'y' } ,
89
+ message : 'No table matches (all PKs have to be specified) fields: [partition1 ,notAValidProp]'
90
90
} , {
91
- doc : { id1 : 'x' } ,
91
+ doc : { partition1 : 'x' } ,
92
92
docInfo : { fields : [ 'notAValidProp' ] } ,
93
93
message : 'No table matches (all PKs have to be specified) fields: [notAValidProp]'
94
94
} , {
95
- doc : { id1 : 'x' , name : 'y' } ,
96
- message : 'No table matches (all PKs have to be specified) fields: [id1 ,name]'
95
+ doc : { partition1 : 'x' , name : 'y' } ,
96
+ message : 'No table matches (all PKs have to be specified) fields: [partition1 ,name]'
97
97
} , {
98
98
doc : { } ,
99
99
message : 'Expected object with keys'
100
100
}
101
101
] ) ) ;
102
102
103
103
it ( 'should warn when cache reaches 100 different queries' , async ( ) => {
104
- const clientInfo = mapperTestHelper . getClient ( [ 'id1 ' ] , [ 1 ] , 'ks1' ) ;
104
+ const clientInfo = mapperTestHelper . getClient ( [ 'partition1 ' ] , [ 1 ] , 'ks1' ) ;
105
105
const modelMapper = mapperTestHelper . getModelMapper ( clientInfo ) ;
106
106
107
107
const cacheHighWaterMark = 100 ;
108
108
const promises = [ ] ;
109
109
110
110
for ( let i = 0 ; i < 2 * cacheHighWaterMark ; i ++ ) {
111
- promises . push ( modelMapper . insert ( { id1 : 1 , [ `col${ i % ( cacheHighWaterMark - 1 ) } ` ] : 1 } ) ) ;
111
+ promises . push ( modelMapper . insert ( { partition1 : 1 , [ `col${ i % ( cacheHighWaterMark - 1 ) } ` ] : 1 } ) ) ;
112
112
}
113
113
114
114
await Promise . all ( promises ) ;
@@ -117,7 +117,7 @@ describe('ModelMapper', () => {
117
117
assert . strictEqual ( clientInfo . logMessages . filter ( l => l . level === 'warning' ) . length , 0 ) ;
118
118
119
119
// One more query
120
- await modelMapper . insert ( { id1 : 1 , anotherColumn : 1 } ) ;
120
+ await modelMapper . insert ( { partition1 : 1 , anotherColumn : 1 } ) ;
121
121
122
122
const warnings = clientInfo . logMessages . filter ( l => l . level === 'warning' ) ;
123
123
assert . strictEqual ( warnings . length , 1 ) ;
@@ -136,9 +136,9 @@ describe('ModelMapper', () => {
136
136
} ,
137
137
items : [
138
138
{
139
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' , name : { prop1 : 1 , prop2 : 'two' } } ,
140
- query : 'INSERT INTO ks1.table1 ("id1 ", "id2 ", "name") VALUES (?, ?, ?)' ,
141
- params : [ 'value_id1 ' , 'value_id2 ' , '{"prop1":1,"prop2":"two"}' ]
139
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' , name : { prop1 : 1 , prop2 : 'two' } } ,
140
+ query : 'INSERT INTO ks1.table1 ("partition1 ", "clustering1 ", "name") VALUES (?, ?, ?)' ,
141
+ params : [ 'value_partition1 ' , 'value_clustering1 ' , '{"prop1":1,"prop2":"two"}' ]
142
142
}
143
143
]
144
144
} ) ) ;
@@ -149,93 +149,93 @@ describe('ModelMapper', () => {
149
149
150
150
it ( 'should retrieve the table that apply and make a single execution' , ( ) => testQueries ( 'update' , [
151
151
{
152
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' } ,
153
- query : 'UPDATE ks1.table1 SET "name" = ? WHERE "id2 " = ? AND "id1 " = ?' ,
152
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' } ,
153
+ query : 'UPDATE ks1.table1 SET "name" = ? WHERE "clustering1 " = ? AND "partition1 " = ?' ,
154
154
params : [ 'name1' , 'value2' , 'value1' ] ,
155
155
isIdempotent : true
156
156
} ] ) ) ;
157
157
158
158
it ( 'should mark LWT queries as non-idempotent' , ( ) => testQueries ( 'update' , [
159
159
{
160
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' } ,
160
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' } ,
161
161
docInfo : { when : { name : 'previous name' } } ,
162
- query : 'UPDATE ks1.table1 SET "name" = ? WHERE "id2 " = ? AND "id1 " = ? IF "name" = ?' ,
162
+ query : 'UPDATE ks1.table1 SET "name" = ? WHERE "clustering1 " = ? AND "partition1 " = ? IF "name" = ?' ,
163
163
params : [ 'name1' , 'value2' , 'value1' , 'previous name' ] ,
164
164
isIdempotent : false
165
165
} ] ) ) ;
166
166
167
167
it ( 'should append/prepend to a list' , ( ) => testQueries ( 'update' , [
168
168
{
169
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' , list1 : q . append ( [ 'a' , 'b' ] ) } ,
170
- query : 'UPDATE ks1.table1 SET "name" = ?, "list1" = "list1" + ? WHERE "id2 " = ? AND "id1 " = ?' ,
169
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' , list1 : q . append ( [ 'a' , 'b' ] ) } ,
170
+ query : 'UPDATE ks1.table1 SET "name" = ?, "list1" = "list1" + ? WHERE "clustering1 " = ? AND "partition1 " = ?' ,
171
171
params : [ 'name1' , [ 'a' , 'b' ] , 'value2' , 'value1' ] ,
172
172
isIdempotent : false
173
173
} , {
174
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' , list1 : q . prepend ( [ 'a' , 'b' ] ) } ,
175
- query : 'UPDATE ks1.table1 SET "name" = ?, "list1" = ? + "list1" WHERE "id2 " = ? AND "id1 " = ?' ,
174
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' , list1 : q . prepend ( [ 'a' , 'b' ] ) } ,
175
+ query : 'UPDATE ks1.table1 SET "name" = ?, "list1" = ? + "list1" WHERE "clustering1 " = ? AND "partition1 " = ?' ,
176
176
params : [ 'name1' , [ 'a' , 'b' ] , 'value2' , 'value1' ] ,
177
177
isIdempotent : false
178
178
} ] ) ) ;
179
179
180
180
it ( 'should increment/decrement a counter' , ( ) => {
181
- const clientInfo = mapperTestHelper . getClient ( [ 'id1 ' , 'id2 ' , { name : 'c1' , type : { code : dataTypes . counter } } ] , [ 1 , 1 ] ) ;
181
+ const clientInfo = mapperTestHelper . getClient ( [ 'partition1 ' , 'clustering1 ' , { name : 'c1' , type : { code : dataTypes . counter } } ] , [ 1 , 1 ] ) ;
182
182
const modelMapper = mapperTestHelper . getModelMapper ( clientInfo ) ;
183
183
const items = [
184
184
{
185
- doc : { id2 : 'value2' , id1 : 'value1' , c1 : q . incr ( 10 ) } ,
186
- query : 'UPDATE ks1.table1 SET "c1" = "c1" + ? WHERE "id2 " = ? AND "id1 " = ?'
185
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , c1 : q . incr ( 10 ) } ,
186
+ query : 'UPDATE ks1.table1 SET "c1" = "c1" + ? WHERE "clustering1 " = ? AND "partition1 " = ?'
187
187
} , {
188
- doc : { id2 : 'another id 2' , id1 : 'another id 1' , c1 : q . decr ( 10 ) } ,
189
- query : 'UPDATE ks1.table1 SET "c1" = "c1" - ? WHERE "id2 " = ? AND "id1 " = ?'
188
+ doc : { clustering1 : 'another id 2' , partition1 : 'another id 1' , c1 : q . decr ( 10 ) } ,
189
+ query : 'UPDATE ks1.table1 SET "c1" = "c1" - ? WHERE "clustering1 " = ? AND "partition1 " = ?'
190
190
} ] ;
191
191
192
192
return Promise . all ( items . map ( ( item , index ) => modelMapper . update ( item . doc ) . then ( ( ) => {
193
193
assert . strictEqual ( clientInfo . executions . length , items . length ) ;
194
194
const execution = clientInfo . executions [ index ] ;
195
195
assert . strictEqual ( execution . query , item . query ) ;
196
- assert . deepStrictEqual ( execution . params , [ 10 , item . doc . id2 , item . doc . id1 ] ) ;
196
+ assert . deepStrictEqual ( execution . params , [ 10 , item . doc . clustering1 , item . doc . partition1 ] ) ;
197
197
helper . assertProperties ( execution . options , { prepare : true , isIdempotent : false } ) ;
198
198
} ) ) ) ;
199
199
} ) ;
200
200
201
201
it ( 'should throw an error when filter or conditions are not valid' , ( ) => testErrors ( 'update' , [
202
202
{
203
- doc : { id1 : 'x' , notAValidProp : 'y' } ,
204
- message : 'No table matches (all PKs and columns to set have to be specified) fields: [id1 ,notAValidProp]'
203
+ doc : { partition1 : 'x' , notAValidProp : 'y' } ,
204
+ message : 'No table matches (all PKs and columns to set have to be specified) fields: [partition1 ,notAValidProp]'
205
205
} , {
206
- doc : { id1 : 'x' } ,
206
+ doc : { partition1 : 'x' } ,
207
207
docInfo : { fields : [ 'notAValidProp' ] } ,
208
208
message : 'No table matches (all PKs and columns to set have to be specified) fields: [notAValidProp]'
209
209
} , {
210
- doc : { id1 : 'x' , name : 'y' } ,
211
- message : 'No table matches (all PKs and columns to set have to be specified) fields: [id1 ,name]'
210
+ doc : { partition1 : 'x' , name : 'y' } ,
211
+ message : 'No table matches (all PKs and columns to set have to be specified) fields: [partition1 ,name]'
212
212
} , {
213
- doc : { id1 : 'x' , id2 : 'y' , name : 'z' } ,
213
+ doc : { partition1 : 'x' , clustering1 : 'y' , name : 'z' } ,
214
214
docInfo : { when : { notAValidProp : 'm' } } ,
215
- message : 'No table matches (all PKs and columns to set have to be specified) fields: [id1,id2 ,name]; condition: [notAValidProp]'
215
+ message : 'No table matches (all PKs and columns to set have to be specified) fields: [partition1,clustering1 ,name]; condition: [notAValidProp]'
216
216
} , {
217
217
doc : { } ,
218
218
message : 'Expected object with keys'
219
219
} , {
220
- doc : { id1 : 'x' , id2 : 'y' } ,
221
- message : 'No table matches (all PKs and columns to set have to be specified) fields: [id1,id2 ]'
220
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
221
+ message : 'No table matches (all PKs and columns to set have to be specified) fields: [partition1,clustering1 ]'
222
222
}
223
223
] ) ) ;
224
224
225
225
it ( 'should use fields when specified' , ( ) => testQueries ( 'update' , [
226
226
{
227
- doc : { id2 : 'value2' , id1 : 'value1' , name : 'name1' , description : 'description1' } ,
228
- docInfo : { fields : [ 'id1 ' , 'id2 ' , 'description' ] } ,
229
- query : 'UPDATE ks1.table1 SET "description" = ? WHERE "id1 " = ? AND "id2 " = ?' ,
227
+ doc : { clustering1 : 'value2' , partition1 : 'value1' , name : 'name1' , description : 'description1' } ,
228
+ docInfo : { fields : [ 'partition1 ' , 'clustering1 ' , 'description' ] } ,
229
+ query : 'UPDATE ks1.table1 SET "description" = ? WHERE "partition1 " = ? AND "clustering1 " = ?' ,
230
230
params : [ 'description1' , 'value1' , 'value2' ]
231
231
} ] ) ) ;
232
232
233
233
it ( 'should set TTL' , ( ) => testQueries ( 'update' , [
234
234
{
235
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' , name : 'value_name1' } ,
235
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' , name : 'value_name1' } ,
236
236
docInfo : { ttl : 360 } ,
237
- query : 'UPDATE ks1.table1 USING TTL ? SET "name" = ? WHERE "id1 " = ? AND "id2 " = ?' ,
238
- params : [ 360 , 'value_name1' , 'value_id1 ' , 'value_id2 ' ]
237
+ query : 'UPDATE ks1.table1 USING TTL ? SET "name" = ? WHERE "partition1 " = ? AND "clustering1 " = ?' ,
238
+ params : [ 360 , 'value_name1' , 'value_partition1 ' , 'value_clustering1 ' ]
239
239
}
240
240
] ) ) ;
241
241
@@ -246,21 +246,21 @@ describe('ModelMapper', () => {
246
246
tables : [ 'table1' ] ,
247
247
columns : {
248
248
'name' : { fromModel : JSON . stringify } ,
249
- 'id2 ' : { fromModel : v => v + "_suffix" }
249
+ 'clustering1 ' : { fromModel : v => v + "_suffix" }
250
250
}
251
251
}
252
252
} ,
253
253
items : [
254
254
{
255
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' , name : { prop1 : 1 , prop2 : 'two' } } ,
256
- query : 'UPDATE ks1.table1 SET "name" = ? WHERE "id1 " = ? AND "id2 " = ?' ,
257
- params : [ '{"prop1":1,"prop2":"two"}' , 'value_id1 ' , 'value_id2_suffix ' ]
255
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' , name : { prop1 : 1 , prop2 : 'two' } } ,
256
+ query : 'UPDATE ks1.table1 SET "name" = ? WHERE "partition1 " = ? AND "clustering1 " = ?' ,
257
+ params : [ '{"prop1":1,"prop2":"two"}' , 'value_partition1 ' , 'value_clustering1_suffix ' ]
258
258
} ,
259
259
{
260
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' , description : 'my description' } ,
260
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' , description : 'my description' } ,
261
261
docInfo : { when : { name : { a : 'a' , b : 2 } } } ,
262
- query : 'UPDATE ks1.table1 SET "description" = ? WHERE "id1 " = ? AND "id2 " = ? IF "name" = ?' ,
263
- params : [ 'my description' , 'value_id1 ' , 'value_id2_suffix ' , '{"a":"a","b":2}' ] ,
262
+ query : 'UPDATE ks1.table1 SET "description" = ? WHERE "partition1 " = ? AND "clustering1 " = ? IF "name" = ?' ,
263
+ params : [ 'my description' , 'value_partition1 ' , 'value_clustering1_suffix ' , '{"a":"a","b":2}' ] ,
264
264
isIdempotent : false
265
265
}
266
266
]
@@ -272,49 +272,49 @@ describe('ModelMapper', () => {
272
272
273
273
it ( 'should throw an error when filter or conditions are not valid' , ( ) => testErrors ( 'remove' , [
274
274
{
275
- doc : { id1 : 'x' , notAValidProp : 'y' } ,
276
- message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [id1 ,notAValidProp]'
275
+ doc : { partition1 : 'x' , notAValidProp : 'y' } ,
276
+ message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [partition1 ,notAValidProp]'
277
277
} , {
278
- doc : { id1 : 'x' } ,
278
+ doc : { partition1 : 'x' } ,
279
279
docInfo : { fields : [ 'notAValidProp' ] } ,
280
280
message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [notAValidProp]'
281
281
} , {
282
- doc : { id1 : 'x' , name : 'y' } ,
283
- message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [id1 ,name]'
282
+ doc : { partition1 : 'x' , name : 'y' } ,
283
+ message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [partition1 ,name]'
284
284
} , {
285
- doc : { id1 : 'x' , id2 : 'y' } ,
285
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
286
286
docInfo : { when : { notAValidProp : 'm' } } ,
287
- message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [id1,id2 ]; condition: [notAValidProp]'
287
+ message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [partition1,clustering1 ]; condition: [notAValidProp]'
288
288
} , {
289
289
doc : { } ,
290
290
message : 'Expected object with keys'
291
291
} , {
292
- doc : { id1 : 'x' , id3 : 'y' } ,
293
- message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [id1,id3 ]'
292
+ doc : { partition1 : 'x' , clustering2 : 'y' } ,
293
+ message : 'No table matches (must specify all partition key and top-level clustering columns) fields: [partition1,clustering2 ]'
294
294
}
295
295
] ) ) ;
296
296
297
297
it ( 'should generate the query, params and set the idempotency' , ( ) => testQueries ( 'remove' , [
298
298
{
299
- doc : { id1 : 'x' , id2 : 'y' } ,
300
- query : 'DELETE FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ?' ,
299
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
300
+ query : 'DELETE FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ?' ,
301
301
params : [ 'x' , 'y' ]
302
302
} , {
303
- doc : { id1 : 'x' , id2 : 'y' } ,
303
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
304
304
docInfo : { when : { name : 'a' } } ,
305
- query : 'DELETE FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ? IF "name" = ?' ,
305
+ query : 'DELETE FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ? IF "name" = ?' ,
306
306
params : [ 'x' , 'y' , 'a' ] ,
307
307
isIdempotent : false
308
308
} , {
309
- doc : { id1 : 'x' , id2 : 'y' } ,
309
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
310
310
docInfo : { ifExists : true } ,
311
- query : 'DELETE FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ? IF EXISTS' ,
311
+ query : 'DELETE FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ? IF EXISTS' ,
312
312
params : [ 'x' , 'y' ] ,
313
313
isIdempotent : false
314
314
} , {
315
- doc : { id1 : 'x' , id2 : 'y' } ,
316
- docInfo : { fields : [ 'id1 ' , 'id2 ' , 'name' ] , deleteOnlyColumns : true } ,
317
- query : 'DELETE "name" FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ?' ,
315
+ doc : { partition1 : 'x' , clustering1 : 'y' } ,
316
+ docInfo : { fields : [ 'partition1 ' , 'clustering1 ' , 'name' ] , deleteOnlyColumns : true } ,
317
+ query : 'DELETE "name" FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ?' ,
318
318
params : [ 'x' , 'y' ]
319
319
}
320
320
] ) ) ;
@@ -326,21 +326,21 @@ describe('ModelMapper', () => {
326
326
tables : [ 'table1' ] ,
327
327
columns : {
328
328
'name' : { fromModel : JSON . stringify } ,
329
- 'id2 ' : { fromModel : v => v + "_suffix" }
329
+ 'clustering1 ' : { fromModel : v => v + "_suffix" }
330
330
}
331
331
}
332
332
} ,
333
333
items : [
334
334
{
335
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' } ,
336
- query : 'DELETE FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ?' ,
337
- params : [ 'value_id1 ' , 'value_id2_suffix ' ]
335
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' } ,
336
+ query : 'DELETE FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ?' ,
337
+ params : [ 'value_partition1 ' , 'value_clustering1_suffix ' ]
338
338
} ,
339
339
{
340
- doc : { id1 : 'value_id1 ' , id2 : 'value_id2 ' } ,
340
+ doc : { partition1 : 'value_partition1 ' , clustering1 : 'value_clustering1 ' } ,
341
341
docInfo : { when : { name : { a : 1 } } } ,
342
- query : 'DELETE FROM ks1.table1 WHERE "id1 " = ? AND "id2 " = ? IF "name" = ?' ,
343
- params : [ 'value_id1 ' , 'value_id2_suffix ' , '{"a":1}' ] ,
342
+ query : 'DELETE FROM ks1.table1 WHERE "partition1 " = ? AND "clustering1 " = ? IF "name" = ?' ,
343
+ params : [ 'value_partition1 ' , 'value_clustering1_suffix ' , '{"a":1}' ] ,
344
344
isIdempotent : false
345
345
} ,
346
346
]
@@ -350,7 +350,7 @@ describe('ModelMapper', () => {
350
350
351
351
function testErrors ( methodName , items ) {
352
352
return Promise . all ( items . map ( item => {
353
- const columns = [ 'id1 ' , 'id2 ' , 'id3 ' , 'name' ] ;
353
+ const columns = [ 'partition1 ' , 'clustering1 ' , 'clustering2 ' , 'name' ] ;
354
354
const clientInfo = mapperTestHelper . getClient ( columns , [ 1 , 2 ] , 'ks1' ) ;
355
355
const modelMapper = mapperTestHelper . getModelMapper ( clientInfo ) ;
356
356
@@ -368,7 +368,7 @@ function testErrors(methodName, items) {
368
368
369
369
async function testQueries ( methodName , items ) {
370
370
let models = null ;
371
- const columns = [ 'id1 ' , 'id2 ' , 'name' , { name : 'list1' , type : { code : dataTypes . list } } , 'description' ] ;
371
+ const columns = [ 'partition1 ' , 'clustering1 ' , 'name' , { name : 'list1' , type : { code : dataTypes . list } } , 'description' ] ;
372
372
373
373
if ( typeof methodName === 'object' ) {
374
374
// Its an object with properties as parameters
0 commit comments