-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtest.ts
34 lines (25 loc) · 869 Bytes
/
test.ts
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
import Surreal from "surrealdb";
import { surrealdbNodeEngines } from "./lib-src/embedded.ts";
async function run(endpoint) {
const surreal = new Surreal({
engines: surrealdbNodeEngines(),
});
console.log(
"connecting " + endpoint,
await surreal.connect(endpoint, { versionCheck: false }),
);
console.log(
"using " + endpoint,
await surreal.use({ namespace: "test", database: "test" }),
);
console.log("version " + await surreal.version());
console.log(
"creating " + endpoint,
await surreal.create("test", { val: 42 }),
);
console.log("selecting " + endpoint, await surreal.select("test"));
console.log("exporting " + endpoint, await surreal.export());
console.log("closing " + endpoint, await surreal.close());
}
run("surrealkv://test.skv");
run("mem://");