@24hr/plattad
v0.2.2
Published
[![pipeline status](https://gitlab.24hr.se/24hr/projects/plattad/badges/master/pipeline.svg)](https://gitlab.24hr.se/rawb/services/content-next/commits/master) [![coverage report](https://gitlab.24hr.se/24hr/projects/plattad/badges/master/coverage.svg)](h
Downloads
55
Maintainers
Keywords
Readme
Plattad
This is a small package that is designed to test how we can secure that information has been saved in the right order to a database without the need of transactions.
It works by writing everything to a log, (every create, update, delete etc) and mergin the data when querying it.
It has support for snapshots, so that merged data is fecthed without going trough all logs, and it can auto delete entries after snapshooting.
How to use
import plattad, {Plattad, PlattadResult} from 'plattad';
const test = () => {
const entity:Plattad = await plattad(options);
const options = {
connectionString: 'sqlite::memory:',
logging: false,
};
await entity.create('foo', 1, { foo: 'riker', bar: 1 });
await entity.update('foo', 2, { foo: 'picard' });
const entry: PlattadResult | null = await entity.get('foo');
console.log(entry);
/*
{
data: {
foo: 'picard',
bar: 1,
}
}
.... and some more meta data
*/
});
test();