postgrejs
Version:
Professional PostgreSQL client NodeJS
28 lines (27 loc) • 735 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArrayCharType = exports.CharType = void 0;
const constants_js_1 = require("../constants.js");
exports.CharType = {
name: 'char',
oid: constants_js_1.DataTypeOIDs.char,
jsType: 'string',
parseBinary(v) {
return v.toString('utf8');
},
encodeBinary(buf, v) {
buf.writeString((v ? '' + v : ' ')[0], 'utf8');
},
parseText(v) {
return '' + v;
},
isType(v) {
return typeof v === 'string' && v.length === 1;
},
};
exports.ArrayCharType = {
...exports.CharType,
name: '_char',
oid: constants_js_1.DataTypeOIDs._char,
elementsOID: constants_js_1.DataTypeOIDs.char,
};