All files / src connection.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 142x       2x     20x   89x   20x    
import { tryCatch } from "fp-ts/lib/TaskEither";
import { mixed } from "io-ts";
import { QueryConfig } from "pg";
import * as pg from "pg";
import { makeDriverQueryError } from "./errors";
import { Connection } from "./types";
 
export const wrapPoolClient = (poolClient: pg.PoolClient): Connection => ({
  query: (config: QueryConfig, context: mixed) =>
    tryCatch(() => poolClient.query(config), makeDriverQueryError(config, context)),
 
  release: err => poolClient.release(err),
});