0.1.12 ā€¢ Published 1 year ago

@pandazy/capybara v0.1.12

Weekly downloads
117
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.9

2 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago