dynamodb-enhanced
Advanced tools
Comparing version 0.4.0-l to 0.4.0-m
@@ -568,19 +568,32 @@ // Copyright Teleportd Ltd. and other Contributors | ||
* @param table the tableName | ||
* @param hash the hashKey | ||
* @param keys the table {id:2,range:3} range is optional | ||
* @param the hash key + operator ex. {id: 'EQ'} | ||
* @param options {attributesToGet, limit, consistentRead, count, | ||
* rangeKeyCondition, scanIndexForward, exclusiveStartKey, indexName} | ||
* rangeKeyCondition, scanIndexForward, exclusiveStartKey, indexName, filter} | ||
* | ||
* @param cb callback(err, tables) err is set if an error occured | ||
*/ | ||
query = function(table, hash, operator, options, cb) { | ||
query = function(table, keys, operators, options, cb) { | ||
var data = {}; | ||
try { | ||
for(var i in hash) { | ||
if(hash.hasOwnProperty(i)) { | ||
hash[i] = {ComparisonOperator: operator, AttributeValueList: [scToDDB(hash[i])]} | ||
for(var i in keys) { | ||
if(keys.hasOwnProperty(i)) { | ||
keys[i] = {ComparisonOperator: operators[i], AttributeValueList: [scToDDB(keys[i])]} | ||
} | ||
} | ||
data.TableName = table; | ||
data.KeyConditions = hash; | ||
data.KeyConditions = keys; | ||
if(options.filter) | ||
{ | ||
var nFilter = {}; | ||
for(var i in options.filter.keys) { | ||
if(options.filter.keys.hasOwnProperty(i)) { | ||
nFilter[i] = {ComparisonOperator: options.filter.operators[i], AttributeValueList: [scToDDB(options.filter.keys[i])]} | ||
} | ||
} | ||
data.queryFilter = nFilter; | ||
} | ||
if(options.attributesToGet) { | ||
@@ -598,18 +611,3 @@ data.AttributesToGet = options.attributesToGet; | ||
} | ||
if(options.rangeKeyCondition) { | ||
for(var op in options.rangeKeyCondition) { // supposed to be only one | ||
if(typeof op === 'string') { | ||
data.RangeKeyCondition = {"AttributeValueList":[],"ComparisonOperator": op.toUpperCase()}; | ||
if(op == 'between' && | ||
Array.isArray(options.rangeKeyCondition[op]) && | ||
options.rangeKeyCondition[op].length > 1) { | ||
data.RangeKeyCondition.AttributeValueList.push(scToDDB(options.rangeKeyCondition[op][0])); | ||
data.RangeKeyCondition.AttributeValueList.push(scToDDB(options.rangeKeyCondition[op][1])); | ||
} | ||
else { | ||
data.RangeKeyCondition.AttributeValueList.push(scToDDB(options.rangeKeyCondition[op])); | ||
} | ||
} | ||
} | ||
} | ||
if(options.scanIndexForward === false) { | ||
@@ -616,0 +614,0 @@ data.ScanIndexForward = false; |
{ | ||
"name": "dynamodb-enhanced", | ||
"version": "0.4.0l", | ||
"version": "0.4.0m", | ||
"description": "Simple DynamoDB Library for Node.js. enhanced version of dynamodb by Stanislas Polu", | ||
@@ -5,0 +5,0 @@ "keywords": ["dynamo", "node", "db", "aws", "amazon"], |
@@ -118,3 +118,3 @@ ## Basics | ||
ddb.query('test', '3d2d6963', {}, function(err, res, cap) {...}); | ||
ddb.query('test', '{id: 3d2d6963}',{id: 'EQ'} ,{filter:{keys:{foo:12},operators:{foo:'GT'}}}, function(err, res, cap) {...}); | ||
@@ -121,0 +121,0 @@ // res: { count: 23, |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
81446
1877