mpackdb
All repositories: gitoria
976 B
import MPackDB, { PrimaryKeyType } from '../src/MPackDB.js';import { rm } from 'fs/promises';const TEST_DB_PATH = 'db/basic';console.log('--- MPackDB Test ---');// Clean upawait rm(TEST_DB_PATH, { recursive: true, force: true });const db = new MPackDB(`${TEST_DB_PATH}/users`, {primaryKey: 'id',primaryKeyType: PrimaryKeyType.NUMBER});console.log('\n1. Insert records');await db.insert({ name: 'Alice', age: 30 });await db.insert({ name: 'Bob', age: 25 });await db.insert({ name: 'Charlie', age: 35 });console.log('✓ Inserted 3 records');console.log('\n2. Read all');const all = await db.find();console.log('✓ Found:', all);console.log('\n3. Find by ID');const alice = await db.find(0);console.log('✓ Found:', alice);console.log('\n4. Check file size');const { statSync } = await import('fs');const stats = statSync(`${TEST_DB_PATH}/users.mpack`);console.log(`✓ File size: ${stats.size} bytes`);console.log('\n✓ MPackDB works!');
Branches
- mastermain branch
Latest commits
- 87888725release 1.0.7caramboleyo
- 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