UNPKG

postgrejs

Version:

Professional PostgreSQL client NodeJS

27 lines (26 loc) 843 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayInt2Type = exports.Int2Type = void 0; const constants_js_1 = require("../constants.js"); const fast_parseint_js_1 = require("../util/fast-parseint.js"); exports.Int2Type = { name: 'int2', oid: constants_js_1.DataTypeOIDs.int2, jsType: 'number', parseBinary(v) { return v.readInt16BE(0); }, encodeBinary(buf, v) { buf.writeInt16BE((0, fast_parseint_js_1.fastParseInt)(v)); }, parseText: fast_parseint_js_1.fastParseInt, isType(v) { return (typeof v === 'number' && Number.isInteger(v) && v >= -32768 && v <= 32767); }, }; exports.ArrayInt2Type = { ...exports.Int2Type, name: '_int2', oid: constants_js_1.DataTypeOIDs._int2, elementsOID: constants_js_1.DataTypeOIDs.int2, };