postgres composite type on node-postgres
After some more work i found a solution to this problem.
var pg = require('pg');
var connectionString = "connection string";
var myType = [
12345,
'you'
];
pg.connect(connectionString, function(err, client, done) {
client.query('SELECT myFunction($1::myType)',
['(' + myType.join(',') + ')' ],
function(err, result) {
// do stuff
done();
});
});
The join will return this: 12345,you
. When adding the bracts it will create a string that will look like this '(12345,'you')'
, in the Postgres DB it will get cast to myType
.