UNPKG

pgwire

Version:

PostgreSQL client library for Node.js which exposes all features of wire protocol

20 lines (17 loc) 297 B
module.exports = { pgliteral, pgident, }; function pgliteral(s) { if (s == null) { return 'NULL'; } return `'` + String(s).replace(/'/g, `''`) + `'`; } function pgident(...segments) { return ( segments .map(it => '"' + it.replace(/"/g, '""') + '"') .join('.') ); }