dynamosaurus 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dynamosaurus/dynamo_class.rb +2 -65
- data/lib/dynamosaurus/version.rb +1 -1
- data/spec/dynamosaurus_spec.rb +0 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 896faf1434dbeb3df206410cd17297f6712f0c47
|
4
|
+
data.tar.gz: 10154ce8f6cc0210919675b4715cb7a54f54aba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e95e9423a56a3e03aea53fb1f0d0cfff9d40fd5362a2428b37c3bf54fb0a959a61a3b04ff9585bc124a020e41f4d06f38ee2fe44028fa5c36f6c18f6d14d1f6
|
7
|
+
data.tar.gz: c05d104a9306f4ff38edfac4d6179999cbaf830f3c9c953636350b34e967310b21bbb157c55662047ecfeae606448230ee684674878995070e6377bf791a9fbc
|
data/Gemfile.lock
CHANGED
@@ -349,68 +349,6 @@ module Dynamosaurus
|
|
349
349
|
end
|
350
350
|
end
|
351
351
|
|
352
|
-
def query_of_all(params, offset_key, limit = 20, scan_index_forward = true)
|
353
|
-
params[:limit] = limit + 1
|
354
|
-
params[:scan_index_forward] = scan_index_forward;
|
355
|
-
|
356
|
-
p params
|
357
|
-
res = dynamo_db.query(params)
|
358
|
-
|
359
|
-
items = []
|
360
|
-
|
361
|
-
if res.items
|
362
|
-
items = res.items.map{|item|
|
363
|
-
new :data => item
|
364
|
-
}
|
365
|
-
end
|
366
|
-
|
367
|
-
ret[table_name] = items
|
368
|
-
ret[:count] = [item.count, limit].min
|
369
|
-
|
370
|
-
if (res[:count] > limit)
|
371
|
-
ret[:next] = res.items[limit][offset_key]
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
def rangeGetList(data, limit = 20, scan_index_forward = true, options={})
|
376
|
-
pkey = hash_key
|
377
|
-
rkey = range_key
|
378
|
-
params = data.is_a?(Array) ?
|
379
|
-
(scan_index_forward ?
|
380
|
-
rangeKeyQuery("#pkey = :pkey_value and #rkey >= :rkey_value", [pkey, rkey], data) :
|
381
|
-
rangeKeyQuery("#pkey = :pkey_value and #rkey <= :rkey_value", [pkey, rkey], data)) :
|
382
|
-
keyQuery("#pkey = :pkey_value", pkey, data)
|
383
|
-
res = query_of_all(params.merge(options), rkey, limit, scan_index_forward)
|
384
|
-
end
|
385
|
-
|
386
|
-
def keyQuery(expression, pkey, data)
|
387
|
-
params = {
|
388
|
-
table_name: table_name,
|
389
|
-
key_condition_expression: expression,
|
390
|
-
expression_attribute_names: {
|
391
|
-
"#pkey" => pkey,
|
392
|
-
},
|
393
|
-
expression_attribute_values: {
|
394
|
-
":pkey_value" => data,
|
395
|
-
}
|
396
|
-
}
|
397
|
-
end
|
398
|
-
|
399
|
-
def rangeKeyQuery(expression, keys, data)
|
400
|
-
params = {
|
401
|
-
table_name: table_name,
|
402
|
-
key_condition_expression: expression,
|
403
|
-
expression_attribute_names:{
|
404
|
-
"#pkey" => hash_key,
|
405
|
-
"#rkey" => range_key,
|
406
|
-
},
|
407
|
-
expression_attribute_values: {
|
408
|
-
":pkey_value" => data[0],
|
409
|
-
":rkey_value" => data[1],
|
410
|
-
}
|
411
|
-
}
|
412
|
-
end
|
413
|
-
|
414
352
|
def query keys, index=nil, option={}
|
415
353
|
query = {
|
416
354
|
:table_name => table_name
|
@@ -554,12 +492,11 @@ module Dynamosaurus
|
|
554
492
|
def put hash, num_hash={}, return_values=nil
|
555
493
|
new_hash = put_data(hash, num_hash)
|
556
494
|
|
557
|
-
|
495
|
+
res = dynamo_db.put_item(
|
558
496
|
:table_name => table_name,
|
559
497
|
:item => new_hash,
|
560
498
|
:return_values => return_values || "NONE"
|
561
|
-
|
562
|
-
res = dynamo_db.put_item(params)
|
499
|
+
)
|
563
500
|
end
|
564
501
|
|
565
502
|
def put_data hash, num_hash={}
|
data/lib/dynamosaurus/version.rb
CHANGED
data/spec/dynamosaurus_spec.rb
CHANGED