-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsource.ts
More file actions
34 lines (29 loc) · 842 Bytes
/
source.ts
File metadata and controls
34 lines (29 loc) · 842 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
import { Client } from "https://deno.land/x/postgres/mod.ts";
const client = new Client({
user: "MATERIALIZE_USERNAME",
database: "materialize",
password: "APP_SPECIFIC_PASSWORD",
hostname: "MATERIALIZE_HOST",
port: 6875,
ssl: true,
})
const main = async ({ response }: { response: any }) => {
try {
await client.connect()
await client.queryObject(
`CREATE SOURCE IF NOT EXISTS counter
FROM LOAD GENERATOR COUNTER
(TICK INTERVAL '500ms')
WITH (SIZE = '3xsmall');`
);
const result = await client.queryObject("SHOW SOURCES")
console.log(result.rows)
} catch (err) {
console.error(err.toString())
} finally {
await client.end()
}
}
export { main }
// Call the main function
main({ response: {} })