From a877b605b9c3867c1f128256287a1b0dd8b687b0 Mon Sep 17 00:00:00 2001 From: rubixcubin Date: Tue, 29 Sep 2015 14:54:46 -0400 Subject: [PATCH 1/2] Scan: - Added ExclusiveStartKey support - scan returns the Count, LastEvaluatedKey and the Items --- src/lib/aws-translators.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/aws-translators.coffee b/src/lib/aws-translators.coffee index 14044ac..c831b5b 100644 --- a/src/lib/aws-translators.coffee +++ b/src/lib/aws-translators.coffee @@ -111,6 +111,7 @@ module.exports.scan = (params, options, callback, keySchema) -> Limit: params.limit TotalSegments: params.totalSegment Segment: params.segment + ExclusiveStartKey: params.ExclusiveStartKey scanFilterFunc = (filter) -> obj = awsParams.ScanFilter @@ -125,7 +126,10 @@ module.exports.scan = (params, options, callback, keySchema) -> @parent.dynamo.scanAsync(awsParams) .then (data)-> - dataTrans.fromDynamo(data.Items) + result = + Items: dataTrans.fromDynamo(data.Items), + Count: data.Count, + LastEvaluatedKey: data.LastEvaluatedKey .nodeify(callback) module.exports.putItem = (obj, options, callback) -> From db52ab81a0d191c1eea93a76d08f92aaf43aa6ff Mon Sep 17 00:00:00 2001 From: rubixcubin Date: Tue, 29 Sep 2015 15:01:32 -0400 Subject: [PATCH 2/2] Edited test to account for new functionality --- test/src/aws-translators.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/src/aws-translators.coffee b/test/src/aws-translators.coffee index 1e5f303..7e0612f 100644 --- a/test/src/aws-translators.coffee +++ b/test/src/aws-translators.coffee @@ -310,7 +310,11 @@ describe 'aws-translators', () -> hashKeyName: 'bar' hashKeyType: 'S' .then (data) -> - expect(data).to.deep.equal(rofl: 'lol') + expect(data).to.deep.equal({ + Count: undefined + Items: {rofl: 'lol'} + LastEvaluatedKey + }) it 'should call getItem of aws', () -> sandbox.spy(dynastyTable.parent.dynamo, "scan")