typeorm-pglite
Version:
PGlite support for TypeORM
29 lines (28 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PGliteDriver = void 0;
const pglite_1 = require("@electric-sql/pglite");
const pglite_pool_1 = require("./pglite-pool");
const pglite_instance_1 = require("./pglite-instance");
class PGliteDriver {
constructor(options) {
var _a;
const boolSerializer = (val) => {
if (val === true || val === "true" || val === 1)
return "TRUE";
if (val === false || val === "false" || val === 0)
return "FALSE";
return val;
};
const mergedOptions = Object.assign(Object.assign({}, options), { serializers: Object.assign({ [pglite_1.types.BOOL]: boolSerializer }, ((_a = options === null || options === void 0 ? void 0 : options.serializers) !== null && _a !== void 0 ? _a : {})) });
pglite_instance_1.PGliteInstance.setOptions(mergedOptions);
}
get driver() {
var _a;
return _a = class {
},
_a.Pool = pglite_pool_1.PGlitePool,
_a;
}
}
exports.PGliteDriver = PGliteDriver;