@citadeldb/wasm 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/citadel_wasm.d.ts +5 -0
- package/citadel_wasm.js +19 -0
- package/citadel_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ db.put(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
|
|
|
42
42
|
const value = db.get(new Uint8Array([1, 2, 3]));
|
|
43
43
|
|
|
44
44
|
// Named tables
|
|
45
|
+
db.createTable("sessions");
|
|
45
46
|
db.tablePut("sessions", new Uint8Array([1]), new Uint8Array([2]));
|
|
46
47
|
|
|
47
48
|
// Stats
|
|
@@ -64,6 +65,7 @@ db.free();
|
|
|
64
65
|
| `put(key, value)` | Insert into default table |
|
|
65
66
|
| `get(key)` | Get from default table |
|
|
66
67
|
| `delete(key)` | Delete from default table |
|
|
68
|
+
| `createTable(table)` | Create a named table |
|
|
67
69
|
| `tablePut(table, key, value)` | Insert into named table |
|
|
68
70
|
| `tableGet(table, key)` | Get from named table |
|
|
69
71
|
| `tableDelete(table, key)` | Delete from named table |
|
package/citadel_wasm.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
export class CitadelDb {
|
|
5
5
|
free(): void;
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
|
+
/**
|
|
8
|
+
* Create a named key-value table. Errors if it already exists.
|
|
9
|
+
*/
|
|
10
|
+
createTable(table: string): void;
|
|
7
11
|
/**
|
|
8
12
|
* Delete a key from the default table.
|
|
9
13
|
* Returns true if the key existed.
|
|
@@ -68,6 +72,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
68
72
|
export interface InitOutput {
|
|
69
73
|
readonly memory: WebAssembly.Memory;
|
|
70
74
|
readonly __wbg_citadeldb_free: (a: number, b: number) => void;
|
|
75
|
+
readonly citadeldb_createTable: (a: number, b: number, c: number, d: number) => void;
|
|
71
76
|
readonly citadeldb_delete: (a: number, b: number, c: number, d: number) => void;
|
|
72
77
|
readonly citadeldb_execute: (a: number, b: number, c: number, d: number) => void;
|
|
73
78
|
readonly citadeldb_executeBatch: (a: number, b: number, c: number, d: number) => void;
|
package/citadel_wasm.js
CHANGED
|
@@ -11,6 +11,25 @@ export class CitadelDb {
|
|
|
11
11
|
const ptr = this.__destroy_into_raw();
|
|
12
12
|
wasm.__wbg_citadeldb_free(ptr, 0);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a named key-value table. Errors if it already exists.
|
|
16
|
+
* @param {string} table
|
|
17
|
+
*/
|
|
18
|
+
createTable(table) {
|
|
19
|
+
try {
|
|
20
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
21
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
|
|
22
|
+
const len0 = WASM_VECTOR_LEN;
|
|
23
|
+
wasm.citadeldb_createTable(retptr, this.__wbg_ptr, ptr0, len0);
|
|
24
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
25
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
26
|
+
if (r1) {
|
|
27
|
+
throw takeObject(r0);
|
|
28
|
+
}
|
|
29
|
+
} finally {
|
|
30
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
14
33
|
/**
|
|
15
34
|
* Delete a key from the default table.
|
|
16
35
|
* Returns true if the key existed.
|
package/citadel_wasm_bg.wasm
CHANGED
|
Binary file
|