brianc / node-pg-types

Type parsing for node-postgres
268 stars 55 forks source link

Doc- types.builtins.NUMERIC usage #87

Closed billreynolds007 closed 4 years ago

billreynolds007 commented 5 years ago

One example in the readme.md is types.setTypeParser(types.builtins.TIMESTAMPTZ, parseFn)

This approach var types = require('pg').types; types.setTypeParser(types.builtins.NUMERIC, function(val) { return parseFloat(val); });

shows an error Cannot read property 'NUMERIC' of undefined

billreynolds007 commented 5 years ago

I ended up doing npm install pg-types

And then, var types = require('pg').types; var pgTypes = require('pg-types');

I could then do types.setTypeParser(pgTypes.builtins.NUMERIC, function(val) { return parseFloat(val); });

charmander commented 5 years ago

This was also fixed in pg@7.12.1 by brianc/node-postgres#1937.

curiousercreative commented 4 years ago

sounds like this issue should be closed?