@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
17 lines • 597 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ByteaBufferType = ByteaBufferType;
const pg_1 = require("pg");
/**
* A value stored in the DB as a bytea buffer.
*/
function ByteaBufferType() {
return {
// Node-postgres returns bytea values as Buffer already.
dbValueToJs: (dbValue) => dbValue,
// PG's representation: '\xDEADBEEF'
stringify: (jsValue) => "\\x" + jsValue.toString("hex"),
parse: (str) => pg_1.types.getTypeParser(pg_1.types.builtins.BYTEA)(str),
};
}
//# sourceMappingURL=ByteaBufferType.js.map
;