-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite.wit
More file actions
53 lines (43 loc) · 1.18 KB
/
sqlite.wit
File metadata and controls
53 lines (43 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package wasm:sqlite-wasi;
interface sqlite {
variant sqlite-value {
null,
integer(s64),
real(f64),
text(string),
blob(list<u8>),
}
record sqlite-row {
columns: list<string>,
values: list<sqlite-value>,
}
record sqlite-error {
code: s32,
message: string,
}
record sqlite-run-info {
changes: u64,
last-insert-rowid: s64,
}
type db-handle = u32;
resource statement {
run: func(params: option<list<sqlite-value>>) -> result<sqlite-run-info, sqlite-error>;
one: func(params: option<list<sqlite-value>>) -> result<option<sqlite-row>, sqlite-error>;
all: func(params: option<list<sqlite-value>>) -> result<list<sqlite-row>, sqlite-error>;
release: func() -> bool;
}
open: func(path: string) -> result<db-handle, sqlite-error>;
exec: func(db: db-handle, sql: string, params: option<list<sqlite-value>>) -> result<u64, sqlite-error>;
prepare: func(db: db-handle, sql: string) -> result<statement, sqlite-error>;
close: func(db: db-handle) -> result<_, sqlite-error>;
}
world sqlite-component {
export sqlite;
}
world sqlite-app {
import sqlite;
}
world sqlite-cli-app {
import sqlite;
export wasi:cli/run@0.2.3;
}