@@ -2,11 +2,10 @@ const assert = require('assert')
2
2
const async = require ( 'async' )
3
3
4
4
const pg = require ( 'pg' )
5
- const pgCopyOut = require ( 'pg-copy-streams' ) . to
6
- const pgCopyIn = require ( 'pg-copy-streams' ) . from
5
+ const { to : pgCopyTo , from : pgCopyFrom } = require ( 'pg-copy-streams' )
7
6
const through2 = require ( 'through2' )
8
7
9
- const pgCopyTransform = require ( '../' ) . transform
8
+ const { transform } = require ( '../' )
10
9
11
10
const client = function ( dsn ) {
12
11
const client = new pg . Client ( dsn )
@@ -36,14 +35,14 @@ const queriesC = ['DROP TABLE IF EXISTS generated', 'CREATE TABLE generated (bod
36
35
async . eachSeries ( queriesA . concat ( queriesB , queriesC ) , clientA . query . bind ( clientA ) , function ( err ) {
37
36
assert . ifError ( err )
38
37
39
- const copyOut = clientA . query ( pgCopyOut ( 'COPY item TO STDOUT BINARY' ) )
38
+ const copyOut = clientA . query ( pgCopyTo ( 'COPY item TO STDOUT BINARY' ) )
40
39
const copyIns = [
41
- clientB . query ( pgCopyIn ( 'COPY product FROM STDIN BINARY' ) ) ,
42
- clientC . query ( pgCopyIn ( 'COPY generated FROM STDIN BINARY' ) ) ,
40
+ clientB . query ( pgCopyFrom ( 'COPY product FROM STDIN BINARY' ) ) ,
41
+ clientC . query ( pgCopyFrom ( 'COPY generated FROM STDIN BINARY' ) ) ,
43
42
]
44
43
45
44
let count = 0
46
- const pct = pgCopyTransform ( {
45
+ const pct = transform ( {
47
46
mapping : [
48
47
{ key : 'id' , type : 'int4' } ,
49
48
{ key : 'ref' , type : 'text' } ,
0 commit comments