Skip to main content

Function: getDataStore()

getDataStore(directory): (id, version?) => Promise<Container>

Defined in: data-stores.ts:22

Returns a data store (e.g. database, cache, etc.) from EventCatalog.

You can optionally specify a version to get a specific version of the data store

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
idstring
version?string

Returns

Promise<Container>

Examples

import utils from '@eventcatalog/utils';

const { getContainer } = utils('/path/to/eventcatalog');

// Gets the latest version of the data store
const container = await getDataStore('orders-db');

// Gets a version of the entity
const container = await getDataStore('orders-db', '0.0.1');

import utils from '@eventcatalog/utils';

const { getContainer } = utils('/path/to/eventcatalog');

// Gets the latest version of the container
const container = await getContainer('User');

// Gets a version of the entity
const container = await getContainer('User', '0.0.1');