brianc / node-pg-pool

A connection pool for node-postgres
MIT License
180 stars 64 forks source link

字段类型int8 #130

Open JamesRen88 opened 5 years ago

JamesRen88 commented 5 years ago

数据库设计字段类型为:int8,通过查询返回字段值是字符串类型了?why

charmander commented 5 years ago

pg was created before a JavaScript primitive that could represent 64-bit integers precisely existed, but you can change the parser to produce a BigInt nowadays:

const types = require('pg').types;

const INT8_OID = 20;

types.setTypeParser(INT8_OID, BigInt);