slonik-interceptor-query-normalisation

1.1.10 • Public • Published

slonik-interceptor-query-normalisation

Travis build status Coveralls NPM version Canonical Code Style Twitter Follow

Normalises Slonik query.

API

import {
  createQueryNormalisationInterceptor
} from 'slonik';
/**
 * @property stripComments Strips comments from the query (default: true).
 */
type ConfigurationType = {|
  +stripComments?: boolean
|};

(configuration?: ConfigurationType) => InterceptorType;

Example usage

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:

SELECT id, full_name FROM person

Package Sidebar

Install

npm i slonik-interceptor-query-normalisation

Weekly Downloads

586

Version

1.1.10

License

BSD-3-Clause

Unpacked Size

13 kB

Total Files

24

Last publish

Collaborators

  • gajus