????

Your IP : 216.73.216.59


Current Path : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/pg/lib/
Upload File :
Current File : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/pg/lib/type-overrides.js

'use strict'

var 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