5.0.1 • Published 6 years ago

pg-metadata v5.0.1

Weekly downloads
363
License
MIT
Repository
github
Last release
6 years ago

pg-metadata

get the metadata of a postresql or redshift db

    var connection = /* anything that exposes a .query('sql', params, function(err, results) {}) interface to a postgresql server */
    var pgMetadata = require('pg-metadata')

    pgMetadata(connection, /* { table: 'tableName', schema: 'schemaName', database: 'databaseName' } */
        function(err, metadata) {

        // prints varchar
        console.log(metadata.mydb.myschema.mytable.columnA.type) 

        // prints 200
        console.log(metadata.mydb.myschema.mytable.columnA.length) 

        // prints true, field is not nullable
        console.log(metadata.mydb.myschema.mytable.columnA.required) 
    })

Doing it yourself

instead of letting pgMetadata run the query, you can run it yourself:

    var pgMetadata = require('pg-metadata')
    var query = pgMetadata.createQuery(/* { table: 'tableName', schema: 'schemaName', database: 'databaseName' } */)

    // run the query and when you get the result set do:
    var metadata = pgMetadata.createMetadataObject(resultSet)    
5.0.1

6 years ago

5.0.0

9 years ago

4.0.0

9 years ago

3.2.0

9 years ago

3.1.0

9 years ago

3.0.0

9 years ago

2.0.0

9 years ago

1.0.0

9 years ago