Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-view-grabber

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-view-grabber

Grab view information from a Postgres database.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

PG View Grabber

Grab view information from a Postgres database.

Use

Install the module with:

npm install pg-view-grabber --save

Configuration

You’ll need to pass in Postgres connection info that will be passed to pg’s Client constructor. This can either be a connection string (Ex: postgres://username:password@localhost/database) or an object:

var myConfig = {
    database: 'postgres',
    host: 'localhost',
    password: '',
    port: 5432,
    user: 'root',
};

Then, pass it in like so:

var pgViewGrabber = require('pg-view-grabber');

pgViewGrabber.config(myConfig);

You’re ready to get started!

API

These methods hang off the main pg-view-grabber module:

pgViewGrabber.config(clientConfig)
  • Arguments:
    • clientConfig (object or string): database configuration passed to pg’s Client
  • Returns:
    • undefined
pgViewGrabber.fromTable(tableName)
  • Arguments:
    • tableName (string): name of table for which to find dependent views
  • Returns:
    • Promise that resolves to an array of ‘view data’ objects with the following keys:
      • viewData.definition: the view's SQL definition
      • viewData.permissions: the view's owner and permissions SQL
      • viewData.schema: the view's schema name
      • viewData.viewName: the view name itself
pgViewGrabber.fromView(viewName)
  • Arguments:
    • viewName (string): name of view for which to find dependent views
  • Returns:
    • Promise that resolves to an array of 'view data' objects
Liquibase Migration Methods

All Liquibase methods have the same argument object:

  • Arguments:
    • options (object):
      • options.name (string): Name of table or view
      • options.author (optional string): “author” for the migration file
      • options.formatFilename (optional function): a function responsible for formatting each migration file's filename. It’s passed a filenameOptions object with the following keys:
        • filenameOptions.author
        • filenameOptions.id
        • filenameOptions.schema
        • filenameOptions.viewName
      • options.id (optional string or number): changeset “id” for the migration file
pgViewGrabber.getTableMigration(options)
  • Returns:
    • Promise that resolves to an array of Liquibase migration templates
pgViewGrabber.getViewMigration(options)
  • Returns:
    • Promise that resolves to an array of Liquibase migration templates
pgViewGrabber.saveTableMigration(options)
  • Returns:
    • Promise that resolves to an array of empty values when all migration files are written
pgViewGrabber.saveViewMigration(options)
  • Returns:
    • Promise that resolves to an array of empty values when all migration files are written

Testing

Testing assumes you’re on the MRN VPN and you have a valid database map in /coins/coins_auth/conn/dbmap.json. Run tests with npm test. Run linting with npm run lint.

FAQs

Package last updated on 27 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc