0.1.12 • Published 2 years ago

@pandazy/capybara v0.1.12

Weekly downloads
117
License
MIT
Repository
github
Last release
2 years ago

Capybara

Overview >>

This is a TypeScript library providing simple database mechanism supporting the features below:

  • functional-rogramming-style basic CRUD operations
  • searches optimized by simple database index

How to use it >>

Create a data table

import { Row } from '@pandazy/capybara';

interface MyRow extends Row {
  name: string;
}

const table: BasicTable<MyRow> = {
  rows: {},
  lastNewId: 0
};

or

import { Row, basicTable } from '@pandazy/capybara';

interface MyRow extends Row {
  name: string;
}

const table = basicTable<MyRow>();

Add new rows to a table

const table = basicTable<MyRow>(); // { rows: {}, lastNewId: 0 }

const rows: MyRow[] = [
  { name: 'foo' },
  { name: 'bar' }
]

const { newRowKeys, updatedTable } = addRowsBasic<MyRow>(table, rows);

/*
  newRowKeys:
    ['1', '2']
  updatedTable:
    { rows: {
          '1': { name: 'foo' },
          '2': { name: 'bar' }
        },
        lastNewId: 2
    }

Update rows

TBD

Remove rows

TBD

Add index to the table

Q:Why index?

A: Index helps improving searching performance by decreasing the complexity.

āˆ† Currently this library only supports simple hashmap index which guarantees a O(1) complexity

TBD

0.1.12

2 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.9

3 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago