0.3.2 • Published 5 years ago

kv-orm v0.3.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

kv-orm

kv-orm is an object-relational mapper for key-value datastores.

Warning! This package is still in active development.

Tooling & Infrastructure

lerna Greenkeeper Commitizen

Source Code

Maintainability codecov License GitHub last commit GitHub code size GitHub repo size

Features

  • Support for multiple key-value datastores in a single application.

    import { MemoryDatastore } from "kv-orm-memory";
    
    const libraryDatastore = new MemoryDatastore();
    const applicationSecrets = new MemoryDatastore();
  • Easy construction of typed entities using Typescript.

    import { BaseEntity, Column, Entity } from "kv-orm";
    
    @Entity(libraryDatastore)
    class Author extends BaseEntity {
      @Column()
      public firstName!: string;
    
      @Column()
      public lastName!: string;
    
      // ...
    }
  • On-demand, lazy-loading: kv-orm won't load properties of a model until they're needed, and will do so seamlessly at the time of lookup.

    let author = Author.get("bbed05da-594e-41d4-9b97-423343543e16"); // 1ms - no properties of the author have been loaded
    
    console.log(await author.firstName); // 60ms - author.firstName is fetched
  • No unnecessary reads: if a property is already in memory, kv-orm won't look it up again unless it needs to.

    let author = Author.get("0486b183-270d-408a-a274-49b45c418c48");
    
    console.log(await author.lastName); // 60ms - author.lastName is fetched
    console.log(await author.lastName); // 1ms - author.lastName is retrieved from memory (no lookup performed)
  • Writes and deletes are completed in the background — allowing your application to get on with what it needs to.

    let author = Author.get("4bc148c5-af48-46ff-a620-3246efc69d91");
    
    author.firstName = "Ernest";
    // Do more, immediately!

Supported Datastores

If there is any other datastore that you'd like to see supported, please create an issue, or make a pull request.

Roadmap

Open bugs Open bugs Open bugs

Packages

Other

Development

  1. Clone this repository: git clone git@github.com:GregBrimble/kv-orm.git
  2. Install the core packages: npm install
  3. Setup:
    1. lerna bootstrap
    2. lerna run build

Linting

npm run lint && lerna run lint

And to automatically fix most problems: npm run format & lerna run format

Tests

lerna run test

Reset

To start from scratch, and get back to a working state with syslinks etc.:

  1. lerna run clean
  2. npm run clean:node && lerna run clean:node
  3. npm install
  4. lerna bootstrap
  5. lerna run build
0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago