npm install --save @mitmaro/sql-template-engine
Creating a SQL Template Engine instance is very straight forward.
const createSqlTemplateEngine = require('@mitmaro/sql-template-engine');
const sqlTemplateEngine = createSqlTemplateEngine({
// options
});import createSqlTemplateEngine from '@mitmaro/sql-template-engine';
const sqlTemplateEngine = createSqlTemplateEngine({
// options
});| Name | Type | Description | Default |
|---|---|---|---|
| cache | AbstractSyntaxTreeCache |
A custom abstract syntax tree cache | Memory |
| epsilon | number |
The allowed error due to rounding in floating point comparisons | Number.EPSILON |
| fileEncoding | string |
The file encoding for template files | UTF-8 |
| rootPath | string |
The root directory for looking for template files | Current working directory |
| maximumCallDepth | number |
The maximum depth of nested includes | 64 |
const result = await sqlTemplateEngine.invokeTemplateFile('template.tpl', {foo: 'bar'});Development is done using Node 8 and NPM 5, and tested against both Node 8 and Node 10. To get started
- Install Node 8 from NodeJS.org or using nvm
- Clone the repository using
git clone git@github.com:MitMaro/node-sql-template-engine.git cd node-sql-template-engine- Install the dependencies
npm install - Make changes, add tests, etc.
- Run linting and test suite using
npm run test - Build using
npm run build
This project is released under the ISC license. See LICENSE.