Skip to content

MitMaro/node-sql-template-engine

Repository files navigation

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

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.

About

A template engine compatible with SQL files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages