@ginger.io/beyonce
Advanced tools
Comparing version 0.0.45 to 0.0.46
@@ -5,3 +5,3 @@ import { JayZ } from "@ginger.io/jay-z"; | ||
import { QueryBuilder } from "./QueryBuilder"; | ||
import { ScanBuilder } from "./ScanBuilder"; | ||
import { ParallelScanConfig, ScanBuilder } from "./ScanBuilder"; | ||
import { Table } from "./Table"; | ||
@@ -22,2 +22,3 @@ import { ExtractKeyType, GroupedModels, TaggedModel } from "./types"; | ||
consistentRead?: boolean; | ||
parallel?: ParallelScanConfig; | ||
}; | ||
@@ -24,0 +25,0 @@ /** A thin wrapper around the DynamoDB sdk client that |
@@ -12,3 +12,8 @@ import { JayZ } from "@ginger.io/jay-z"; | ||
consistentRead?: boolean; | ||
parallel?: ParallelScanConfig; | ||
}; | ||
export declare type ParallelScanConfig = { | ||
segmentId: number; | ||
totalSegments: number; | ||
}; | ||
/** Builds and executes parameters for a DynamoDB Scan operation */ | ||
@@ -15,0 +20,0 @@ export declare class ScanBuilder<T extends TaggedModel> extends QueryExpressionBuilder<T> { |
@@ -75,3 +75,3 @@ "use strict"; | ||
buildScan(options) { | ||
const { table, consistentRead } = this.config; | ||
const { table, consistentRead, parallel } = this.config; | ||
const { expression, attributeNames, attributeValues } = this.build(); | ||
@@ -93,2 +93,4 @@ const filterExp = expression !== "" ? expression : undefined; | ||
Limit: options.pageSize, | ||
Segment: parallel === null || parallel === void 0 ? void 0 : parallel.segmentId, | ||
TotalSegments: parallel === null || parallel === void 0 ? void 0 : parallel.totalSegments, | ||
}; | ||
@@ -95,0 +97,0 @@ } |
{ | ||
"name": "@ginger.io/beyonce", | ||
"version": "0.0.45", | ||
"version": "0.0.46", | ||
"description": "Type-safe DynamoDB query builder for TypeScript. Designed with single-table architecture in mind.", | ||
@@ -20,6 +20,6 @@ "main": "dist/index.js", | ||
"libsodium-wrappers": "^0.7.8", | ||
"prettier": "^1.19.1", | ||
"yargs": "^15.3.1" | ||
}, | ||
"devDependencies": { | ||
"prettier": "^1.19.1", | ||
"@shelf/jest-dynamodb": "^1.7.0", | ||
@@ -26,0 +26,0 @@ "@types/jest": "^25.1.4", |
@@ -277,2 +277,29 @@ # Beyonce | ||
#### Parallel Scans | ||
You can perform "parallel scans" by passing a `parallel` config operation to the `.scan` method, | ||
like so: | ||
```TypeScript | ||
// Somewhere inside of Worker 1 | ||
const segment1 = beyonce | ||
.scan({ parallel: { segmentId: 0, totalSegments: 2 }}) | ||
.iterator() | ||
for await (const results of segment1) { | ||
// ... | ||
} | ||
// Somewhere inside of Worker 2 | ||
const segment2 = beyonce | ||
.scan({ parallel: { segmentId: 1, totalSegments: 2 }}) | ||
.iterator() | ||
for await (const results of segment2) { | ||
// ... | ||
} | ||
``` | ||
These options mirror the underlying [DynamoDB API](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan) | ||
### BatchGet | ||
@@ -279,0 +306,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
146217
7
1854
420
0
11
+ Added@types/node@22.10.0(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)
- Removedprettier@^1.19.1
- Removed@types/node@22.10.1(transitive)
- Removedprettier@1.19.1(transitive)
- Removedwhich-typed-array@1.1.16(transitive)