0.1.0 • Published 7 years ago
@mitmaro/sql-template-engine v0.1.0
SQL Template Engine
Install
npm install --save @mitmaro/sql-template-engineDocumentation
Usage
Creating an instance
Creating a SQL Template Engine instance is very straight forward.
JavaScript
const createSqlTemplateEngine = require('@mitmaro/sql-template-engine');
const sqlTemplateEngine = createSqlTemplateEngine({
// options
});TypeScript
import createSqlTemplateEngine from '@mitmaro/sql-template-engine';
const sqlTemplateEngine = createSqlTemplateEngine({
// options
});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 |
Invoking a template file
const result = await sqlTemplateEngine.invokeTemplateFile('template.tpl', {foo: 'bar'});Development
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
License
This project is released under the ISC license. See LICENSE.
0.1.0
7 years ago