0.1.7 • Published 1 year ago

key-value-abstract-store v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

WIP

Example

example-1.ts (run with npm run tsfile ./tests/example-1.ts).

import {KvasInMemoryJsonDataSource} from '@in-memory-json/kvas-in-memory-json-data-source';
import {jsonStringifySafe} from '@in-memory-json/kvas-in-memory-json-utils';

const ds = KvasInMemoryJsonDataSource.createSyncDataSource();
ds.setJSO(['b', 0], 'value-1'); // JSO for JS Object
ds.setJSO(['b', 1, 'c'], 'value-2');
ds.setJSO(['b', 3, 'd', 'e', 1], 'value-2');
console.log(jsonStringifySafe(ds.getJSO([]).prop.value, 2));
/**
 *  {
 *    "b": [
 *      "value-1",
 *      {
 *        "c": "value-2"
 *      },
 *      null,
 *      {
 *        "d": {
 *          "e": [
 *            null,
 *            "value-2"
 *          ]
 *        }
 *      }
 *    ]
 *  }
 */

TODO

  • Async
  • Make a generic sync and/or async proxy that will use .sync or .promise on all functions
  • Async implementation for DynamoDB
  • Async implementation for PostgreSQL
  • Async implementation for file system