UNPKG

postgrejs

Version:

Professional PostgreSQL client NodeJS

29 lines (28 loc) 870 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayInt4Type = exports.Int4Type = void 0; const constants_js_1 = require("../constants.js"); const fast_parseint_js_1 = require("../util/fast-parseint.js"); exports.Int4Type = { name: 'int4', oid: constants_js_1.DataTypeOIDs.int4, jsType: 'number', parseBinary(v) { return v.readInt32BE(0); }, encodeBinary(buf, v) { buf.writeInt32BE((0, fast_parseint_js_1.fastParseInt)(v)); }, parseText: fast_parseint_js_1.fastParseInt, isType(v) { return (typeof v === 'number' && Number.isInteger(v) && v <= Number.MAX_SAFE_INTEGER); }, }; exports.ArrayInt4Type = { ...exports.Int4Type, name: '_int4', oid: constants_js_1.DataTypeOIDs._int4, elementsOID: constants_js_1.DataTypeOIDs.int4, };