103 lines
2.5 KiB
JavaScript
103 lines
2.5 KiB
JavaScript
// Metro module 1911 (f1912).
|
|
import { Table, TableTransaction } from "./TableTransaction";
|
|
import { ConflictOptions } from "./Module1914";
|
|
class Dao {
|
|
constructor(a0, a1, a2, r8 = true) {
|
|
this.originalPrefix = a0;
|
|
this.table = new Table([a0], a1, a2, r8);
|
|
}
|
|
get prefix() {
|
|
return this.table.prefix;
|
|
}
|
|
withoutLogging() {
|
|
const originalPrefix = this.originalPrefix;
|
|
const tableId = this.table.tableId;
|
|
const database = this.table.database;
|
|
const r17 = {
|
|
__proto__: Dao.prototype
|
|
};
|
|
r17.originalPrefix = originalPrefix;
|
|
r17.table = new Table([originalPrefix], tableId, database, false);
|
|
return r17;
|
|
}
|
|
get(a0) {
|
|
return this.table.get([a0]);
|
|
}
|
|
getMany(a0) {
|
|
return this.table.getMany([], a0);
|
|
}
|
|
getRange(a0, a1, a2) {
|
|
return this.table.getRange([a0], [a1], a2);
|
|
}
|
|
getKvEntries() {
|
|
return this.table.getKvEntries();
|
|
}
|
|
getMapEntries() {
|
|
return this.table.getMapEntries();
|
|
}
|
|
getIds() {
|
|
return this.table.getChildIds([]);
|
|
}
|
|
getParentId(a0) {
|
|
return this.table.getParentId([null, a0]);
|
|
}
|
|
put(a0, a1, r4 = ConflictOptions.Replace) {
|
|
return this.table.put({
|
|
key: [a0],
|
|
data: a1,
|
|
generation: null
|
|
}, r4);
|
|
}
|
|
delete(a0) {
|
|
return arguments.length === 0 ? this.table.delete() : this.table.delete([a0]);
|
|
}
|
|
transaction(c13303_0, a1) {
|
|
return this.table.transaction((a0) => {
|
|
const r10 = {
|
|
__proto__: DaoTransaction.prototype
|
|
};
|
|
r10.transaction = a0;
|
|
return c13303_0(r10);
|
|
}, a1);
|
|
}
|
|
upgradeTransaction(a0) {
|
|
const transaction2 = this.table.upgradeTransaction(a0);
|
|
const r11 = {
|
|
__proto__: DaoTransaction.prototype
|
|
};
|
|
r11.transaction = transaction2;
|
|
return r11;
|
|
}
|
|
getManySyncUnsafe(a0) {
|
|
return this.table.getManySyncUnsafe([], a0);
|
|
}
|
|
getMapEntriesSyncUnsafe() {
|
|
return this.table.getMapEntriesSyncUnsafe();
|
|
}
|
|
}
|
|
class DaoTransaction {
|
|
constructor(a0) {
|
|
this.transaction = a0;
|
|
}
|
|
static fromDatabaseTransaction(a0, a1, a2) {
|
|
const tableTransaction = new TableTransaction(a0, a1, a2);
|
|
const r20 = {
|
|
__proto__: DaoTransaction.prototype
|
|
};
|
|
r20.transaction = tableTransaction;
|
|
return r20;
|
|
}
|
|
put(a0, a1, r4 = ConflictOptions.Replace) {
|
|
this.transaction.put({
|
|
key: [a0],
|
|
data: a1,
|
|
generation: null
|
|
}, r4);
|
|
}
|
|
delete(a0) {
|
|
return arguments.length === 0 ? this.transaction.delete() : this.transaction.delete([a0]);
|
|
}
|
|
}
|
|
export { Dao };
|
|
export { DaoTransaction };
|