UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

27 lines 906 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StringArrayType = StringArrayType; const pg_1 = require("pg"); /** * It is in pg-types/lib/textParsers.js (1015::regtype is "character * varying[]"), just not exported to TS types. */ const VARCHAR_ARRAY_OID = 1015; /** * An array of Strings. Note: node-postgres natively supports this type on read * path, but on write path, we have to stringify by ourselves. */ function StringArrayType() { return { dbValueToJs: (dbValue) => dbValue, stringify: (jsValue) => "{" + jsValue .map((v) => v === null ? "NULL" : `"${v.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`) .join(",") + "}", parse: (str) => pg_1.types.getTypeParser(VARCHAR_ARRAY_OID)(str), }; } //# sourceMappingURL=StringArrayType.js.map