mpackdb
All repositories: gitoria
1.2 KB
import MPackDB from '../src/MPackDB.js';import { rm } from 'fs/promises';const TEST_DB_PATH = 'db/crud';await rm(TEST_DB_PATH, { recursive: true, force: true });console.log('starting crud users test');const users = new MPackDB(`${TEST_DB_PATH}/users`);await users.insert({ name: 'John', age: 20, email: '[email protected]' });await users.insert({ name: 'Alice', age: 25, email: '[email protected]' });await users.insert({ name: 'Bob', age: 20, email: '[email protected]' });await users.insert({ name: 'Diane', age: 25, email: '[email protected]' });await users.insert({ name: 'Eve', age: 30, email: '[email protected]' });await users.insert({ name: 'Frank', age: 35, email: '[email protected]' });await users.insert({ name: 'Grace', age: 40, email: '[email protected]' });await users.insert({ name: 'Hank', age: 45, email: '[email protected]' });await users.insert({ name: 'Ivy', age: 50, email: '[email protected]' });await users.insert({ name: 'Jack', age: 55, email: '[email protected]' });for await (const user of users.find()) {console.log(user);}await users.delete(u => u.age === 20);await users.update(u => u.name === 'Alice', { name: 'Alice Doe', email: '[email protected]', age: 25 });console.log('users', await users.find());console.log('crud users test complete');
Branches
- mastermain branch
Latest commits
- c4cdb9b6node: import prefixes (Deno compat) + pre-existing index-state WIPcaramboleyo
- 0afb8f4bupdate now must be a callbackcaramboleyo
- cde73eb4release 1.0.6caramboleyo
- d01dda02add index hints, intersection, boundingBox; remove findByIndexcaramboleyo
- b8ffc1a0release 1.0.5caramboleyo
- d47876a1reimplemented lost features like indexed find and more testscaramboleyo
- 7f08da9afixed insert ignoring model definitioncaramboleyo
- 705774a9added flush before findcaramboleyo
- b4db6391initial commitcaramboleyo