db-lite (2019.8.20)
this zero-dependency package will provide a persistent, in-browser database, with a working web-demo
download standalone app
run internal test
reset database
export database -> file
import database <- file
edit or paste script below to
eval
/*jslint browser: true, node: true*/ "use strict"; var dbTable1, gotoState, gotoNext; gotoState = 0; gotoNext = function (err, data) { gotoState = err ? Infinity : gotoState + 1; switch (gotoState) { case 1: dbTable1 = window.dbTable1 = window.utility2_db.dbTableCreateOne({ name: "dbTable1" }, gotoNext); break; case 2: dbTable1.idIndexCreate({ name: "field1" }, gotoNext); break; case 3: dbTable1.crudSetOneById({ field1: "aa", field2: 1, field3: "foo" }, gotoNext); break; case 4: dbTable1.crudSetOneById({ field1: "bb", field2: 2, field3: "bar" }, gotoNext); break; case 5: dbTable1.crudSetOneById({ field1: "cc", field2: 3, field3: "baz" }, gotoNext); break; case 6: dbTable1.crudRemoveOneById({ field1: "aa" }, gotoNext); break; case 7: dbTable1.crudUpdateOneById({ field1: "bb", field2: -1 }, gotoNext); break; case 8: dbTable1.crudSetOneById({ field2: Math.random() }, gotoNext); break; case 9: dbTable1.crudGetManyByQuery({ limit: Infinity, query: { field2: { $gte: -Infinity, $lte: Infinity } }, skip: 0, sort: [{ fieldName: "_timeUpdated", idDescending: true }] }, gotoNext); break; case 10: console.error(data); dbTable1.crudCountAll(gotoNext); break; case 11: console.error("number of rows: " + data); break; default: console.error(err.stack); } }; gotoNext();
eval script
stderr and stdout
[ this app was created with
utility2
]