node-postgres
node-postgres copied to clipboard
Auto-injecting query comments
It would be great to have support for injecting query comments into every query automatically, e.g. via config.
The use case is that these comments can then be used for analysis by tools like pganalyze.
See an example of a Ruby gem: https://github.com/basecamp/marginalia
I am thinking a config prop with string or factory type:
interface ConfigWithQueryComments {
banner: string | () => string
}
Then:
const pool = new Pool({
// ...
banner: JSON.stringify({ app: 'foo', version: '1.2.3' })
})