@begin/data
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@begin/data", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Begin Data is a durable and fast key/value document store built on top of DynamoDB.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,3 +5,3 @@ # Begin Data | ||
Begin Data is a durable and fast key/value store built on top of DynamoDB with super simple storage/access patterns that are similar to Redis. | ||
Begin Data is a durable and fast key/value store built on top of DynamoDB with only three core API methods: `get`, `set` and `destroy`. | ||
@@ -29,2 +29,28 @@ ## Concepts | ||
Or equiv CloudFormation YAML: | ||
```yaml | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
Resources: | ||
BeginData: | ||
Type: "AWS::DynamoDB::Table" | ||
Properties: | ||
TableName: "data" | ||
BillingMode: "PAY_PER_REQUEST" | ||
KeySchema: | ||
- | ||
AttributeName: "scopeID" | ||
KeyType: "HASH" | ||
- | ||
AttributeName: "dataID" | ||
KeyType: "RANGE" | ||
SSESpecification: | ||
Enabled: "false" | ||
TimeToLiveSpecification: | ||
AttributeName: "ttl" | ||
Enabled: "TRUE" | ||
``` | ||
> Note 👉🏽 non [Architect](https://arc.codes) projects will need `BEGIN_DATA_TABLE_NAME` environment variable. You can also use this env var to override and name the table anything you want. This also allows for mulitple apps to share a single table. | ||
### API | ||
@@ -38,11 +64,11 @@ | ||
- `data.get(params, [callback])` for retreiving data | ||
- `data.set(params, [callback])` for writing data | ||
- `data.destroy(params, [callback])` for removing data | ||
- `data.get(params, [callback]) → Promise` for retreiving data | ||
- `data.set(params, [callback]) → Promise` for writing data | ||
- `data.destroy(params, [callback]) → Promise` for removing data | ||
Additional helper methods are also made available: | ||
- `data.incr(params, [callback])` increment an attribute on an document | ||
- `data.decr(params, [callback])` decrement an attribute on an document | ||
- `data.count(params, [callback])` get the number of documents for a given table | ||
- `data.incr(params, [callback]) → Promise` increment an attribute on an document | ||
- `data.decr(params, [callback]) → Promise` decrement an attribute on an document | ||
- `data.count(params, [callback]) → Promise` get the number of documents for a given table | ||
@@ -49,0 +75,0 @@ All methods accept params object and, optionally, a Node style errback. If no errback is supplied a promise is returned. All methods support `async`/`await`. |
@@ -6,2 +6,4 @@ /** | ||
module.exports = function unfmt(obj) { | ||
if (!obj) | ||
return null | ||
let copy = {...obj} | ||
@@ -8,0 +10,0 @@ copy.key = obj.dataID.split('#')[2] |
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
26093
258
740
162