Comments (1)
So we created @begin/data
to make it easier to get started with DynamoDB doing simple persistence tasks. This is a perfect use case!
@begin/data
There is only one database table for all the data defined in an .arc
app that uses @begin/data
. It is defined as follows:
@app
myapp
@tables
data
scopeID *String
dataID **String
ttl TTL
The
.arc
above defines a single DynamoDB table with a partition key ofscopeID
and a sort key ofdataID
. This table can optionally have items that expire by setting thettl
attribute on rows
From here on reading and writing is done completely in code. @begin/data
methods always have a table
attribute but under the hood this is a virtual table of data! I would model the system with separate tables. A good convention is to use plural form of the noun the table represents. I'm not entirely sure what Image represents so I'm just going to focus on the user/org/post nouns.
let data = require('@begin/data')
// create a new org
await data.set({
table: 'orgs',
key: 'engineering'
})
// adds a brand new user (and will automatically create key)
let user = await data.set({
table: 'users',
org: 'engineering',
name: 'brian'
})
let post = await data.set({
table: `users-${user.key}`,
title: 'my post',
body: 'some wisdom here'
})
Let me know if this makes sense so far!
from begin-data.
Related Issues (13)
- "main" field pointing to wrong place on file system in package.json throws deprecation warning HOT 1
- Re-enable publishing module to GHPR when it goes GA HOT 1
- Add range queries for both table and name
- Add support for sort keys HOT 2
- Deno version HOT 1
- Add support for secondary indexes
- Feat req: UI for Data HOT 4
- Help with writing more than 25 documents to Begin Data
- keys with `-` hanging set HOT 1
- Raw scopeID and dataID are returned from incr/decr
- @architect/sandbox v4.xx breaks with @begin/2.0.1, and v3 is not released HOT 4
- support for `begin` param on bulk get HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from begin-data.