CLI for scaffolding out PostgreSQL stored procedures
$ npm install --global pg-stored-procedure
$ pgsp --help
Usage
$ pgsp [name]
Options
--path / -p Path to SQL file output
(Outputs to clipboard if omitted)
Examples
$ pgsp get_user_info
$ pgsp get_user_info -p .
npm install pg-stored-procedure
const pgsp = require('pg-stored-procedure');
pgsp('foo_bar');
//=>
// DROP TYPE IF EXISTS type_foo_bar CASCADE;
// CREATE TYPE type_foo_bar AS (
// );
// CREATE OR REPLACE FUNCTION foo_bar(
// ) RETURNS SETOF type_foo_bar AS $FUNCTION$
// DECLARE
// BEGIN
// END;
// $FUNCTION$ LANGUAGE plpgsql;
Type: string
Name of the stored procedure.
MIT © Hoishin