beginner-corp / begin-data

A durable and fast key/value store for Begin built on top of DynamoDB
79 stars 8 forks source link

Factory WIP #96

Open brianleroux opened 3 years ago

brianleroux commented 3 years ago

Common feedback that folks want a scoped factory constructor for begin/data. Usage as follows:

let { Table, factory } = require('@begin/data')

// constructor style
let cats = new Table('cats')
await cats.set({ meow: 'hi' })

// factory style
let [cats, dogs] = factory('cats', 'dogs')
await Promise.all([
  cats.set({ hi: 'meow' }),
  dogs.set({ hi: 'woof' })
])
tbeseda commented 3 years ago

Coming from other libraries, I like having this option, and the usage looks great 👍