https://github.com/gajus/slonik-interceptor-query-normalisation
Normalises Slonik queries.
https://github.com/gajus/slonik-interceptor-query-normalisation
postgresql slonik
Last synced: 3 months ago
JSON representation
Normalises Slonik queries.
- Host: GitHub
- URL: https://github.com/gajus/slonik-interceptor-query-normalisation
- Owner: gajus
- License: other
- Created: 2019-02-22T15:14:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T07:41:38.000Z (over 5 years ago)
- Last Synced: 2025-06-21T13:44:09.625Z (4 months ago)
- Topics: postgresql, slonik
- Language: JavaScript
- Size: 14.6 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slonik-interceptor-query-normalisation
[](https://travis-ci.org/gajus/slonik-interceptor-query-normalisation)
[](https://coveralls.io/github/gajus/slonik-interceptor-query-normalisation)
[](https://www.npmjs.org/package/slonik-interceptor-query-normalisation)
[](https://github.com/gajus/canonical)
[](https://twitter.com/kuizinas)Normalises [Slonik](https://github.com/gajus/slonik) query.
## API
```js
import {
createQueryNormalisationInterceptor
} from 'slonik';```
```js
/**
* @property stripComments Strips comments from the query (default: true).
*/
type ConfigurationType = {|
+stripComments?: boolean
|};(configuration?: ConfigurationType) => InterceptorType;
```
## Example usage
```js
import {
createPool
} from 'slonik';
import {
createQueryNormalisationInterceptor
} from 'slonik-interceptor-query-normalisation';const interceptors = [
createQueryNormalisationInterceptor({
stripComments: true
})
];const connection = createPool('postgres://', {
interceptors
});connection.any(sql`
-- Foo bar.
SELECT
id,
full_name
FROM person
`);```
Evalutes query:
```sql
SELECT id, full_name FROM person```