Skip to content

Repository files navigation

SQL Template Engine

Service StatusBuild StatusCoverage StatusNPM versionGitHub licenseKnown 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

constcreateSqlTemplateEngine=require('@mitmaro/sql-template-engine');constsqlTemplateEngine=createSqlTemplateEngine({// options});

TypeScript

importcreateSqlTemplateEnginefrom'@mitmaro/sql-template-engine';constsqlTemplateEngine=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

constresult=awaitsqlTemplateEngine.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.

About

A template engine compatible with SQL files.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages