-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
44 lines (33 loc) · 966 Bytes
/
index.ts
File metadata and controls
44 lines (33 loc) · 966 Bytes
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
import * as edgedb from "edgedb";
import e from "./dbschema/edgeql-js";
const client = edgedb.createClient();
(async () => {
// const result = await client.query("SELECT User { id, first_name };");
// console.log(result);
// const queryTyped = e.select(e.User, () => ({
// id: true,
// full_name: true,
// }));
// const resultTyped = await queryTyped.run(client);
// console.log(resultTyped);
// const insertPost = e.insert(e.Post, {
// title: "Hello World",
// body: "This is my first post",
// author: e
// .select(e.User, (person) => ({
// filter: e.op(person.first_name, "=", "Mateusz"),
// }))
// .assert_single(),
// });
// await insertPost.run(client);
const selectPost = e.select(e.Post, () => ({
title: true,
body: true,
author: {
id: true,
full_name: true,
},
}));
const resultPost = await selectPost.run(client);
console.log(resultPost);
})();