Skip to content

Commit 2e80d49

Browse files
committed
Add transform option for columns
1 parent 1c1a4a7 commit 2e80d49

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/backend.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function Backend({
1111
onready,
1212
resolve,
1313
reject,
14+
transform,
1415
onnotice,
1516
onnotify
1617
}) {
@@ -183,7 +184,7 @@ function Backend({
183184
start = index
184185
while (x[index++] !== 0);
185186
columns[i] = {
186-
n: x.utf8Slice(start, index - 1),
187+
n: transform(x.utf8Slice(start, index - 1)),
187188
p: parsers[x.readInt32BE(index + 6)]
188189
}
189190
index += 18

lib/connection.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { errors } from './types.js'
77

88
export default function Connection(options = {}) {
99
const {
10+
transform,
1011
database,
1112
user,
1213
timeout,
@@ -34,6 +35,7 @@ export default function Connection(options = {}) {
3435
})
3536

3637
const backend = Backend({
38+
transform,
3739
parsers,
3840
resolve,
3941
reject,

lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ function parseOptions(url, options = {}) {
359359
username : env.PGUSERNAME || os.userInfo().username,
360360
password : env.PGPASSWORD || '',
361361
max : Math.max(1, os.cpus().length - 1),
362-
fifo : false
362+
fifo : false,
363+
transform : x => x
363364
},
364365
typeof url === 'string' ? parseUrl(url) : url,
365366
options,

0 commit comments

Comments
 (0)