{"_id":"sql-tag","_rev":"7-f42df8a5eeb7dc4e4afc9f721a45834d","name":"sql-tag","description":"A template tag for writing elegant sql strings","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"name":"sql-tag","version":"0.0.1","repository":{"type":"git","url":"https://github.com/seegno/sql-tag.git"},"description":"A template tag for writing elegant sql strings","keywords":["es6","multiline","sql","sql-tag","string","strings","tagged","template"],"author":{"name":"Rui Marinho","email":"rui.marinho@seegno.com","url":"https://github.com/ruimarinho"},"homepage":"https://github.com/seegno/sql-tag","bugs":{"url":"https://github.com/seegno/sql-tag/issues"},"license":"MIT","scripts":{"changelog":"github-changes -o seegno -r sql-tag -a --only-pulls --use-commit-body --title 'Changelog' --date-format '/ YYYY-MM-DD'","test":"NODE_ENV=test ./node_modules/.bin/mocha test/*_test.js --require should --reporter spec"},"devDependencies":{"github-changes":"0.0.16","mocha":"^2.1.0","should":"^5.0.1"},"engines":{"iojs":">= 1.0.0"},"gitHead":"a2c5c236448f8df7d48d60ab20138066a75b3b48","_id":"sql-tag@0.0.1","_shasum":"e42e704046b3668b59f946aed6eec45ab7d36388","_from":".","_npmVersion":"2.5.1","_nodeVersion":"1.3.0","_npmUser":{"name":"ruimarinho","email":"ruipmarinho@gmail.com"},"maintainers":[{"name":"ruimarinho","email":"ruipmarinho@gmail.com"}],"dist":{"shasum":"e42e704046b3668b59f946aed6eec45ab7d36388","tarball":"https://registry.npmjs.org/sql-tag/-/sql-tag-0.0.1.tgz","integrity":"sha512-Vxk3C9VKZZuOjbQKTO5fcxcT1qFqk6QM8n9ohH3oVpJk00rSPjvruuz1cSY/zknSQCTrw0Z70L71SmxMrJBGXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2rO/sfea0VlzPHu+GSxOHn06jH8Dn8Hh1l9UFBJeIeAIhALMBrPn0MM+J6C9/tQcF/ozCOXnFCj3cOI5kE+4QnNK1"}]}},"1.0.0":{"name":"sql-tag","version":"1.0.0","description":"A template tag for writing elegant sql strings","keywords":["es6","es2015","multiline","sql","sql-tag","string","strings","tagged","template"],"homepage":"https://github.com/seegno/sql-tag","bugs":{"url":"https://github.com/seegno/sql-tag/issues"},"license":"MIT","author":{"name":"Rui Marinho","email":"rui.marinho@seegno.com","url":"https://github.com/ruimarinho"},"main":"dist/src/index.js","repository":{"type":"git","url":"git+https://github.com/seegno/sql-tag.git"},"scripts":{"changelog":"github_changelog_generator --no-issues --header-label='# Changelog' --future-release=v$npm_config_future_release && sed -i '' -e :a -e '$d;N;2,4ba' -e 'P;D' CHANGELOG.md","lint":"eslint src test","prepublish":"npm run transpile","test":"NODE_ENV=test mocha $npm_package_options_mocha","transpile":"rm -rf dist/* && babel src --out-dir dist/src && cp package.json dist/","version":"npm run changelog --future-release=$npm_package_version && npm run transpile && git add -A CHANGELOG.md dist"},"devDependencies":{"babel-cli":"^6.11.4","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015-node4":"^2.1.0","babel-register":"^6.11.6","eslint":"^3.3.0","eslint-config-seegno":"^6.0.0","mocha":"^3.0.2","pre-commit":"^1.1.2","should":"^11.0.0"},"engines":{"node":">=4"},"options":{"mocha":"--compilers js:babel-register --recursive --require should"},"pre-commit":["lint"],"gitHead":"91770c4f4e94e8874d6b7befb163af7e00afcb05","_id":"sql-tag@1.0.0","_shasum":"f407194e83026d37e163d47e999510dcef54171e","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"ruimarinho","email":"ruipmarinho@gmail.com"},"dist":{"shasum":"f407194e83026d37e163d47e999510dcef54171e","tarball":"https://registry.npmjs.org/sql-tag/-/sql-tag-1.0.0.tgz","integrity":"sha512-3a6dsQov844DEHxvixPXzh6y4oxUJ5KrOiw/Jwb8Ux6xO5agAbuvfGV0wN5gSZL7IAaO5/xOf6C4mEL3XgO2qw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsqq+FcxSm1kEGvq/iDKYb3dvsoGhSuSyyYtK3Tv6FzgIhAOisv1VVnyfHsgwoG3R1pPv+Aox5yhHL3/kz4OHqWqer"}]},"maintainers":[{"name":"ruimarinho","email":"ruipmarinho@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sql-tag-1.0.0.tgz_1471474951829_0.858235975028947"}},"1.0.1":{"name":"sql-tag","version":"1.0.1","description":"A template tag for writing elegant sql strings","keywords":["es6","es2015","multiline","sql","sql-tag","string","strings","tagged","template"],"homepage":"https://github.com/seegno/sql-tag","bugs":{"url":"https://github.com/seegno/sql-tag/issues"},"license":"MIT","author":{"name":"Rui Marinho","email":"rui.marinho@seegno.com","url":"https://github.com/ruimarinho"},"main":"dist/src/index.js","repository":{"type":"git","url":"git+https://github.com/seegno/sql-tag.git"},"scripts":{"changelog":"github_changelog_generator --no-issues --header-label='# Changelog' --future-release=v$npm_config_future_release && sed -i '' -e :a -e '$d;N;2,4ba' -e 'P;D' CHANGELOG.md","lint":"eslint src test","prepublish":"npm run transpile","test":"NODE_ENV=test mocha $npm_package_options_mocha","transpile":"rm -rf dist/* && babel src --out-dir dist/src && cp package.json dist/","version":"npm run changelog --future-release=$npm_package_version && npm run transpile && git add -A CHANGELOG.md dist"},"devDependencies":{"babel-cli":"^6.11.4","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015-node4":"^2.1.0","babel-register":"^6.11.6","eslint":"^3.3.0","eslint-config-seegno":"^6.0.0","mocha":"^3.0.2","pre-commit":"^1.1.2","should":"^11.0.0"},"engines":{"node":">=4"},"options":{"mocha":"--compilers js:babel-register --recursive --require should"},"pre-commit":["lint"],"gitHead":"f2802ca2027a050e9e4ae9a86458081cfdb18153","_id":"sql-tag@1.0.1","_shasum":"c21098cf17a2a45ae83771b101d498f253ed4907","_from":".","_npmVersion":"3.10.8","_nodeVersion":"8.0.0-nightly201611033c1e5b366f","_npmUser":{"name":"ruimarinho","email":"ruipmarinho@gmail.com"},"dist":{"shasum":"c21098cf17a2a45ae83771b101d498f253ed4907","tarball":"https://registry.npmjs.org/sql-tag/-/sql-tag-1.0.1.tgz","integrity":"sha512-DpIM4Cjuu9PoZC83LURXJjMbixR+AvSzjxv8+qLU3T6lAVHoDiMigBAgq3Rfw9S45x8vO+LJMFx6+HWAbic6eQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFtBhltTYWucc7J59hSKns8QTQ0EHfIl4l274pypMA3FAiEA7xAxinAVwk1ZsDrnWCMGCo33KOUfJMyNZ+Fe8vi9fO0="}]},"maintainers":[{"name":"ruimarinho","email":"ruipmarinho@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sql-tag-1.0.1.tgz_1478223938820_0.5448693495709449"}}},"readme":"# sql-tag\n\nA template tag for writing elegant parameterized SQL queries based on [ES2015 tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals).\n\nCompatible with [pg](#integration-with-pgpg-native), [pg-native](#integration-with-pgpg-native), [mysql](#integration-with-mysqlmysql2) and [mysql2](#integration-with-mysqlmysql2). Read more about [sequelize](#integration-with-sequelize) support.\n\n## Status\n\n[![npm version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n\n## Installation\n\nInstall the package via `npm`:\n\n```bash\n$ npm install --save sql-tag\n```\n\n## Usage\n\n#### Arguments\n1. `query` *(string)*: The sql query.\n2. `[...*]` *(...\\*)*: The query replacements.\n\n#### Returns\n*(Object)*: A structured object with the sql query string and its replacements.\n\n#### Examples\n```js\nconst sql = require('sql-tag');\nconst out = sql`SELECT * FROM biz WHERE id = ${'foo'}`;\n// => { sql: 'SELECT * FROM biz WHERE id = ?', query: 'SELECT * FROM biz WHERE id = $1', values: ['foo'] }\n```\n\n```js\nconst sql = require('sql-tag');\nconst foo = 'bar';\nconst out = sql`SELECT * FROM biz\n  WHERE id = ${foo}\n`;\n// => { sql: 'SELECT * FROM biz\\n  WHERE id = ?\\n', query: 'SELECT * FROM biz\\n  WHERE id = $1\\n', values: ['bar'] }\n```\n\nThe tag itself is framework agnostic. It should just require a small modification to the query generator function.\n\n**NOTE**: the `sql` tag does not provide any kind of escaping safety. It delegates that work to the underlying framework.\n\n### Integration with [pg](https://github.com/brianc/node-postgres)/[pg-native](https://github.com/brianc/node-pg-native)\n\nThe output format is `sql-tag` is directly compatible with `pg` and `pg-native` parameterized queries.\n\n```js\nconst pg = require('pg');\nconst client = new pg.Client();\nconst sql = require('sql-tag');\n\nclient.connect(function (err) {\n  if (err) throw err;\n\n  client.query(sql`SELECT * FROM foo WHERE id = ${'foo'}`).then(console.log);\n});\n```\n\n### Integration with [mysql](https://www.npmjs.com/package/mysql)/[mysql2](https://www.npmjs.com/package/mysql2)\n\n```js\nconst mysql = require('mysql');\nconst connection = mysql.createConnection({ user: 'root', password: 'root' });\nconst sql = require('sql-tag');\n\nconnection.query(sql`SELECT * FROM foo WHERE id = ${'foo'}`, (err, rows) => console.log(err, rows));\n```\n\n### Integration with [sequelize](https://github.com/sequelize/sequelize)\n\nSequelize requires a special format to be able to handle parameterized queries. Check out the [sequelize-sql-tag](https://www.npmjs.com/sequelize-sql-tag) plugin which builds on top of `sql-tag` to provide this functionality.\n\n## Tests\n\n```sh\nnpm test\n```\n\n## Release\n\n```sh\nnpm version [<newversion> | major | minor | patch] -m \"Release %s\"\n```\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/sql-tag.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/sql-tag\n[travis-image]: https://img.shields.io/travis/seegno/sql-tag/v1.0.0.svg?style=flat-square\n[travis-url]: https://travis-ci.org/seegno/sql-tag\n","maintainers":[{"name":"ruimarinho","email":"ruipmarinho@gmail.com"}],"time":{"modified":"2022-06-26T23:15:12.881Z","created":"2015-02-24T00:47:21.205Z","0.0.1":"2015-02-24T00:47:21.205Z","1.0.0":"2016-08-17T23:02:33.466Z","1.0.1":"2016-11-04T01:45:39.318Z"},"homepage":"https://github.com/seegno/sql-tag","keywords":["es6","es2015","multiline","sql","sql-tag","string","strings","tagged","template"],"repository":{"type":"git","url":"git+https://github.com/seegno/sql-tag.git"},"author":{"name":"Rui Marinho","email":"rui.marinho@seegno.com","url":"https://github.com/ruimarinho"},"bugs":{"url":"https://github.com/seegno/sql-tag/issues"},"license":"MIT","readmeFilename":"README.md","users":{"elussich":true}}