1.0.2 • Published 7 years ago

sql-inports v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

sql-inports

A simple pre-processor for building sql from multiple files.

To include a .sql file:

-- @include ./path/to/file.sql

To include all .sql files in a folder:

-- @include ./path/to/dir

example:

main.sql:

-- @include ./my_func.sql
select * from my_func();

my_func.sql:

create or replace function my_func() returns void as $$
declare
  -- variables go here
begin
  -- logic goes here
end;
$$ LANGUAGE plpgsql;

output.sql:

-- INCLUDE: ./my_func.sql

create or replace function my_func() returns void as $$
declare
  -- variables go here
begin
  -- logic goes here
end;

-- INCLUDE END;

select * from my_func();

file.js:

var fs = require('fs');
var compileSQL = require('sql-inports');

fs.writeFileSync('./output.sql', compileSQL('./main.sql'));
1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago