0.1.0 • Published 5 years ago

@mitmaro/sql-template-engine v0.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

SQL Template Engine

Service Status Build Status Coverage Status NPM version GitHub license Known Vulnerabilities

Install

npm install --save @mitmaro/sql-template-engine

Documentation

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

NameTypeDescriptionDefault
cacheAbstractSyntaxTreeCacheA custom abstract syntax tree cacheMemory
epsilonnumberThe allowed error due to rounding in floating point comparisonsNumber.EPSILON
fileEncodingstringThe file encoding for template filesUTF-8
rootPathstringThe root directory for looking for template filesCurrent working directory
maximumCallDepthnumberThe maximum depth of nested includes64

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.