jukebox
All repositories: gitoria
1.5 KB
// Cross-compat phase A step 1: the REAL JS mpackdb v1.0.7 writes a db that// the Zig port (compat_driver.zig verify_a / mutate_a) then reads and mutates.//// Setup (mpackdb source + its msgpackr dep live OUTSIDE the repo):// cp -r /media/STORAGE/projects/mpackdb-reference /tmp/mpackdb-run// cd /tmp/mpackdb-run && npm install// Run:// MPACKDB=/tmp/mpackdb-run node write_a.mjs /tmp/compat/users_aimport { pathToFileURL } from 'url';const MOD = process.env.MPACKDB || '/tmp/mpackdb-run';const { default: MPackDB } = await import(pathToFileURL(MOD + '/src/MPackDB.js'));const dbfile = process.argv[2];if (!dbfile) throw new Error('usage: write_a.mjs <dbfile>');const db = new MPackDB(dbfile, { primaryKey: '*id', indexes: ['email', '*age'] });const id0 = await db.insert({name: 'Alice Ünicode ✓',email: '[email protected]',age: 30,balance: 1234.56,tags: ['admin', 'staff'],profile: { lang: 'de', theme: null },created: new Date(1721996422123),});const id1 = await db.insert({ name: 'Bob', email: '[email protected]', age: 25, big: 5000000000 });const id2 = await db.insert({ name: 'Carol', email: '[email protected]', age: 35 });const id3 = await db.insert({ name: 'Dave', email: '[email protected]', age: 40 });const id4 = await db.insert({ name: 'Eva Müller', email: '[email protected]', age: 28 });console.log('inserted ids:', id0, id1, id2, id3, id4);const deleted = await db.delete(id2);console.log('deleted id=2 (Carol):', deleted.length, 'record(s)');await db.close();console.log('JS write_a done');
Branches
Latest commits
- 64bc7823Records: #21 causemre
- 76639655Records: B1 questionmre
- d7906b36Records: mission 005 startedmre
- d3df773cMission 005: doc linemre
- 6a5d840aMission 005: jukebox#22mre
- 13e5e748Records: mission 004 startedmre
- a8098271Mission 004: jukebox#21mre
- df8f5205Records: jukebox#19-21, #11 closedmre
- b7a4e692Records: hybriel#298mre
- 9bcbb017Records: day38b waits for day39 fixmre
- f80504e1Records: day38b repro sentmre
- 8048258bRecords: day38b jb3 regression, L1 Chromes stoppedmre
- 68aace7fRecords: mission 003 day38bmre
- d105d8a9Records: mpackdb integrity check cleanmre
- 6e980c53Records: mpackdb rule refinementmre
- 6d335ac4Records: storage copy rulingmre
- 7eb2898dRecords: mpackdb second-opener rule until day38mre
- b011f98eRecords: style form live on day35mre
- 60d90cb2Records: L1 woken for the restartmre
- 75ae544fRecords: restart waits for the connection to closemre