View Code? Open in Web Editor
NEW
A fully typed TypeScript and Node.js implementation of PostgreSQL format() to safely create dynamic SQL queries. SQL identifiers and literals are escaped to help prevent SQL injection.
Home Page: https://npm.im/@scaleleap/pg-format
License: MIT License
JavaScript 1.68%
TypeScript 98.32%
pg-format's People
Contributors
Watchers
pg-format's Issues
There are a number of valid linting issues, that are currently just disabled. Need to fix them.
Need to fix this @ts-ignore
.
// @ts-ignore
return fmt . replace ( re , ( _ , type : string ) : string => {
How do I get a single array like this:
# select '[{"a": 1}, {"b": 2}]'::jsonb;
jsonb
-- --------------------
[{" a" : 1 }, {" b" : 2 }]
instead of separate jsonb array elements like this:
> literal ( [ { a :1 } , { b :2 } ] )
`'{"a":1}'::jsonb,'{"b":2}'::jsonb`