Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jmikedupont2/3911dce8ed24d989151a71971f122b5f to your computer and use it in GitHub Desktop.
Save jmikedupont2/3911dce8ed24d989151a71971f122b5f to your computer and use it in GitHub Desktop.
eliza query
import { PGlite } from "@electric-sql/pglite";
const db = new PGlite("file:///var/run/agent/database/");
//let res = await db.query("select table_schema, count(*) from information_schema.tables group by table_schema;");
//let res = await db.query("select table_name,table_schema from information_schema.tables where table_schema = 'public';");
let res = await db.query("select * from public.worlds;");
//console.log(res)
res.rows.forEach((row) => {
console.log("World",row);
});
let res2 = await db.query("select * from public.agents;");
//console.log(res2)
res2.rows.forEach((row) => {
console.log("Agent", row);
});
let res3 = await db.query("select * from public.rooms;");
//console.log(res3)
res3.rows.forEach((row) => {
console.log("Room", row);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment