Skip to content

Commit 1ed9f1f

Browse files
author
~ape
authored
Merge pull request #20 from itsravenous/cast_int_array_searches
Cast integers when searching arrays
2 parents b69a121 + 9f28f70 commit 1ed9f1f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,13 @@ module.exports = Adapter => class PostgreSQLAdapter extends Adapter {
297297
function mapValueCast (value) {
298298
index++
299299
parameters.push(value)
300-
return `$${index}${Buffer.isBuffer(value) ? '::bytea' : ''}`
300+
let cast = '';
301+
if (Buffer.isBuffer(value)) {
302+
cast = '::bytea'
303+
} else if (typeof value === 'number' && value % 1 === 0) {
304+
cast = '::int'
305+
}
306+
return `$${index}${cast}`
301307
}
302308

303309
function mapValue (value) {

0 commit comments

Comments
 (0)