Skip to content

Commit

Permalink
feat: expose an API to set type parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Aug 13, 2019
1 parent 4a01d9b commit d24d405
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/db/postgres.ts
Expand Up @@ -337,6 +337,16 @@ export class Postgres {
return Object.keys(order).map(column => `"${column}" ${order[column]}`)
}

/**
* Control how a specific postgres type will be handled
* Check https://github.com/brianc/node-pg-types for more info
* @param oid - a number representing a type
* @param parser - function that handles the parsing
*/
setTypeParser(oid: number, parser: (value: any) => any) {
pg.types.setTypeParser(oid, parser)
}

/**
* Close db connection
*/
Expand Down

0 comments on commit d24d405

Please sign in to comment.