postgrejs
Version:
Professional PostgreSQL client NodeJS
34 lines (33 loc) • 858 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArrayBoolType = exports.BoolType = void 0;
const constants_js_1 = require("../constants.js");
exports.BoolType = {
name: 'bool',
oid: constants_js_1.DataTypeOIDs.bool,
jsType: 'boolean',
parseBinary(v) {
return !!v.readUInt8();
},
encodeBinary(buf, v) {
buf.writeInt8(v ? 1 : 0);
},
parseText(v) {
return (v === 'TRUE' ||
v === 't' ||
v === 'true' ||
v === 'y' ||
v === 'yes' ||
v === 'on' ||
v === '1');
},
isType(v) {
return typeof v === 'boolean';
},
};
exports.ArrayBoolType = {
...exports.BoolType,
name: '_bool',
oid: constants_js_1.DataTypeOIDs._bool,
elementsOID: constants_js_1.DataTypeOIDs.bool,
};