Sprintf-style postgres query formatting and escape helper functions.
Forked from pg-escape
Format the given arguments using a format string
Emit verbatim
Format as a dollar quoted string
Format as a SQL string.
Format as an identifier.
Format as a literal.
%s
formats the argument value as a simple string.%Q
formats the argument value as a dollar quoted string. A null value is treated as an empty string.%I
treats the argument value as an SQL identifier, double-quoting it if necessary. It is an error for the value to be null.%L
stringifies JSON objects, SQL-quotes small strings, dollar-quotes long strings, and emits NULLs, numbers, and booleans unquoted.%J
stringifies the value then emits as either a SQL-string or a dollar-quoted string, depending on the length of the resulting JSON.%%
In addition to the format specifiers described above, the special sequence %% may be used to output a literal % character.
MIT