memory-adapter
A library that implements the Write Model and Read Model Adapter interface for storing events and projections in memory. Useful for development and testing but not for production, obviously 😛.
Methods
build
build({ entityName }, { eventStore, projectionStore )
builds a read-model and write-model adapter
Parameters
attribute
type
description
entityName
string
the name of the entity
eventStore
object
(optional) an object where keys are entityNames and values are arrays of commit objects
projectionStore
object
(optional) an object where keys are entity names and values are projections objects keyed by id
Returns
an object with write model methods and read model methods
Example
const memoryAdapterBuilder = require('serverless-cqrs.memory-adapter')
module.exports = memoryAdapterBuilder.build({
entityName: 'todo'
})You can also provide the initial eventStore and/or projectionStore objects (both are optional). This is useful when writing tests.
Last updated
Was this helpful?