TenantAtlas/apps/platform/.pnpm-store/v10/files/e8/3462fa657659200abbf3cd975d3bcdc95f7d1302700a388d08691e1915ae3d390f3dbc5a42ed04f05666aacb6a14239aec285070c81317664b17abfd991857
Ahmed Darrazi 9f74f7a658
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
feat: compress governance operator outcomes
2026-04-19 14:15:11 +02:00

36 lines
770 B
Plaintext

'use strict'
const types = require('pg-types')
function TypeOverrides(userTypes) {
this._types = userTypes || types
this.text = {}
this.binary = {}
}
TypeOverrides.prototype.getOverrides = function (format) {
switch (format) {
case 'text':
return this.text
case 'binary':
return this.binary
default:
return {}
}
}
TypeOverrides.prototype.setTypeParser = function (oid, format, parseFn) {
if (typeof format === 'function') {
parseFn = format
format = 'text'
}
this.getOverrides(format)[oid] = parseFn
}
TypeOverrides.prototype.getTypeParser = function (oid, format) {
format = format || 'text'
return this.getOverrides(format)[oid] || this._types.getTypeParser(oid, format)
}
module.exports = TypeOverrides