gitoriaLog in with ident

mpackdb

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7f08da9a7f08da9afixed insert ignoring model definitioncaramboleyo7f08da9a/tests/crud.test.js

1.1 KB

  1. import MPackDB from '../src/MPackDB.js';
  2. const TEST_DB_PATH = 'db/crud';
  3. console.log('starting crud users test');
  4. const users = new MPackDB(`${TEST_DB_PATH}/users`);
  5. await users.insert({ name: 'John', age: 20, email: '[email protected]' });
  6. await users.insert({ name: 'Alice', age: 25, email: '[email protected]' });
  7. await users.insert({ name: 'Bob', age: 20, email: '[email protected]' });
  8. await users.insert({ name: 'Diane', age: 25, email: '[email protected]' });
  9. await users.insert({ name: 'Eve', age: 30, email: '[email protected]' });
  10. await users.insert({ name: 'Frank', age: 35, email: '[email protected]' });
  11. await users.insert({ name: 'Grace', age: 40, email: '[email protected]' });
  12. await users.insert({ name: 'Hank', age: 45, email: '[email protected]' });
  13. await users.insert({ name: 'Ivy', age: 50, email: '[email protected]' });
  14. await users.insert({ name: 'Jack', age: 55, email: '[email protected]' });
  15. for await (const user of users.find()) {
  16. console.log(user);
  17. }
  18. await users.delete(u => u.age === 20);
  19. await users.update(u => u.name === 'Alice', { name: 'Alice Doe', email: '[email protected]', age: 25 });
  20. console.log('users', await users.find());
  21. console.log('crud users test complete');

Branches

Latest commits

  • 7f08da9afixed insert ignoring model definitioncaramboleyo
  • 705774a9added flush before findcaramboleyo
  • b4db6391initial commitcaramboleyo