| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Given table [foo smallint] [bar varchar(10)]
var metadata = ... // use pg-metadata module
var validate = require('pg-validate')
// Validate for PostgreSQL
var errors = validate.pg.object({
foo: 1280000,
bar: 'aaaaaa'
}, metadata)
// Validate for Redshift
var errors = validate.redshift.object({
foo: 1280000,
bar: 'aaaaaa'
}, metadata)
// Or the verbose way
var errors = validate.object({
foo: 1280000,
bar: 'aaaaaa'
}, metadata, { platform: validate.REDSHIFT })For the purposes of validation, there's no difference between time and timetz, or timestamp and timestamptz. This is because PostgreSQL silently ignores time zones for types without a time zone. And though Redshift stores dates in UTC, it does accept input values with a time zone - with the exception of full time zone names like "America/New_York".
Not currently supported:
Requires a PostgreSQL or Redshift database. Create a dummy user and database (nothing is written by the tests) and specify the credentials in the PG_VALIDATE environment variable:
PG_VALIDATE=postgres://user:password@localhost:5432/database npm test
| Back | FazBrowse Home | New Git URL |