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>();
const rows: MyRow[] = [
{ name: 'foo' },
{ name: 'bar' }
]
const { newRowKeys, updatedTable } = addRowsBasic<MyRow>(table, rows);
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