Open
Description
Hello, thanks for a wonderful pg library!
I'm trying to get binary support working, and have a minimal proof of concept here:
const pg = require("pg");
pg.types.setTypeParser(1184, "binary", (value) =>
value === null ? null : value.readBigInt64BE(0),
);
async function getTimestamptzAsBigInt() {
const client = new pg.Client({
host: "localhost",
user: "postgres",
password: "postgres",
database: "postgres",
port: 5432,
binary: true,
});
await client.connect();
const result = await client.query({
text: "SELECT current_timestamp;",
queryMode: 'extended',
});
// This should be a BigInt representing number of microseconds
// since midnight, January 1st, 2000
console.log(result.rows[0].current_timestamp);
await client.end();
}
getTimestamptzAsBigInt().catch(console.error);
But it requires some minor patches: #3316
Wdyt?
Metadata
Metadata
Assignees
Labels
No labels