@24hr/plattad 中文文档教程

发布于 3年前 浏览 24 更新于 3年前

Plattad

管道状态coverage report

这是一个小包,旨在测试我们如何确保信息以正确的顺序保存到数据库中,而不需要交易。

它通过将所有内容写入日志(每次创建、更新、删除等)并在查询时合并数据来工作。

它支持快照,因此无需遍历所有日志即可合并数据,并且可以在快照后自动删除条目。

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();

#

Plattad

pipeline statuscoverage report

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();

#

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文