Javascript IndexedDb wrapper, promise based, very simple and lightweight
let dbService = new IndexedDbService();
-databaseName: each service instance manages 1 databese -dataTables: array of objects with properties name, keyPath and index names
await dbService.init("MyDatabase", [
{ name: "DataTable1", keyPath: "id", indexes: ["name"] },
{ name: "DataTable2", keyPath: "id", indexes: ["name"] },
]);
await dbService.updateOrCreate("DataTable1", {id:1, name:"Name1"});
await dbService.updateOrCreate("DataTable1", {id:1, name:"Name2"});
await dbService.updateOrCreate("DataTable1", {name:"Name2", newProp:"Some Value"});
-tableName -value (id)
let data = await dbService.get("DataTable1", 1);
-tableName -value -indexName
let data = await dbService.get("DataTable1", "Name2", "name");
-tableName -value (id)
await dbService.delete("DataTable1", 1);
-tableName -value -indexName
await dbService.delete("DataTable1", "Name2", "name");