Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

primaryKey name / type #1

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ A 4th parameter is a configuration object:
* `delay: number` adjust the delay in millisecond between two scan
* `dyCapacityUnitLimit: number` defined a dynamodb capacity unit limit to stop scan if it's reached
* `progressCallbackInterval: number` interval in millisecond for calling progress callback
* `primaryKeyName: string` the name of your primary key (default: 'uuid')
* `primaryKeyType: string` the dynamoDB type of your primary key (default: 'S')

then you can call the `run` method to start the scan stream to kinesis.
it returns a promise where your callback will call at the end of a full scan.
Expand Down
83 changes: 49 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 40 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
{
"name": "dyki",
"version": "1.0.0",
"description": "Scan DynamoDB items to dispatch into Kinesis Stream",
"keywords": [
"aws",
"serverless",
"amazon web service",
"dynamodb",
"kinesis",
"stream",
"elastic"
],
"repository": {
"type": "git",
"url": "https://github.com/pierozi/dyki"
},
"bugs": "https://github.com/pierozi/dyki/issues",
"maintainers": [{
"name": "Pierre Tomasina",
"web": "http://continuous.lu"
}],
"contributors": [{
"name": "Pierre Tomasina",
"web": "http://continuous.lu"
}],
"main": "src/main.js",
"scripts": {
"test": "node tests/scratch.js"
},
"author": "Pierre Tomasina <pierre.tomasina@continuous.lu> (continuous.lu)",
"license": "MIT",
"dependencies": {
"aws-sdk": "^2.84.0",
"base-64": "^0.1.0",
"when": "^3.7.8"
}
"name": "dyki",
"version": "1.0.0",
"description": "Scan DynamoDB items to dispatch into Kinesis Stream",
"keywords": [
"aws",
"serverless",
"amazon web service",
"dynamodb",
"kinesis",
"stream",
"elastic"
],
"repository": {
"type": "git",
"url": "https://github.com/pierozi/dyki"
},
"bugs": "https://github.com/pierozi/dyki/issues",
"maintainers": [
{
"name": "Pierre Tomasina",
"web": "http://continuous.lu"
}
],
"contributors": [
{
"name": "Pierre Tomasina",
"web": "http://continuous.lu"
}
],
"main": "src/main.js",
"scripts": {
"test": "node tests/scratch.js"
},
"author": "Pierre Tomasina <pierre.tomasina@continuous.lu> (continuous.lu)",
"license": "MIT",
"dependencies": {
"aws-sdk": "^2.697.0",
"base-64": "^0.1.0",
"when": "^3.7.8"
}
}
6 changes: 4 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ DyKi.Config = {
dyCapacityUnitLimit: 5,
delay: 1000,
progressCallbackInterval: 1000,
primaryKeyName: 'uuid',
primaryKeyType: 'S',
};

DyKi.Error = class extends Error {};
Expand Down Expand Up @@ -68,7 +70,7 @@ DyKi.Client = class {
}

clearInterval(progressInterval);

if (this.EOF) {
return when(this.info());
}
Expand Down Expand Up @@ -135,7 +137,7 @@ DyKi.Client = class {

const params = {
Data: JSON.stringify(record),
PartitionKey: item.uuid['S'],
PartitionKey: item[this.config.primaryKeyName][this.config.primaryKeyType],
StreamName: this.streamName,
};

Expand Down