diff --git a/README.md b/README.md index 4012c8e..300b459 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ import DdbCsv from 'dynamocsv'; const service = new DdbCsv({ client: new DynamoDBClient({}), - target: 'dump.csv', + target: 'dump.csv', // (string, WritableStream, async callback) input: { tableName: 'ddb_test_table', index: 'awesomeness' }, + format: 'csv', // (csv | json | object) query: { keyCondExpressionMap: { hash: 'test', @@ -26,7 +27,8 @@ await service.exec(); ### Args + *client* - An instance of DynamoDBClient, example uses aws-sdk 3, but v2 should also work -+ *target* - file name with extension, or an instance of Node.js WriteStream. ++ *target* - file name with extension, or an instance of Node.js WriteStream or async callback. ie. `async (rows) => { const result = await writeToDb(rows); return result.count; }`; ++ *format* - csv (default) | json | object - object requires a writable stream in object mode or use an async callback to capture values.k + *input* + *tableName* - string (required) + *index* - string (optional) @@ -34,4 +36,4 @@ await service.exec(); + *query* - a simplified mapping to generate `KeyConditionExpression` and `FilterExpression`. See example above - key/val pair generates a simple equality condition, use an object to specify operator and value if needed. + *keyCondExpressionMap* + *filterExpressionMap* -+ *rowPredicate* - (row, context) => row - a function that is called for each row. See example above - use the `context` methods to modify headers as needed. ++ *rowPredicate* - `(row, context) => row` - a function that is called for each row. See example above - use the `context` methods to modify headers as needed. diff --git a/dynamocsv.ts b/dynamocsv.ts index 001674e..4986a1f 100644 --- a/dynamocsv.ts +++ b/dynamocsv.ts @@ -93,7 +93,7 @@ export default class Dynamocsv { return this.headers; } - applyRowPredicate = (row: any) => { + private applyRowPredicate = (row: any) => { return this.rowPredicate ? this.rowPredicate(row, this) : row; };