title |
---|
Utilities |
import { Alert } from '/components/alert.tsx'
Escapes a string as a SQL identifier.
const { escapeIdentifier } = require('pg')
const escapedIdentifier = escapeIdentifier('FooIdentifier')
console.log(escapedIdentifier) // '"FooIdentifier"'
Escapes a string as a SQL literal.
const { escapeLiteral } = require('pg')
const escapedLiteral = escapeLiteral("hello 'world'")
console.log(escapedLiteral) // "'hello ''world'''"