0.1.0 • Published 8 years ago
sql-query-tag v0.1.0
sql-query-tag
Easy sql queries using tagged templates.
install
npm install any-db any-db-[adapter] sql-query-tag
Replace 'adapter' with mssql, mysql, postgres or sqlite3.
usage
import SQLQueryTag from 'sql-query-tag';
const psql = SQLQueryTag('postgres://localhost/mydatabase');
// using promises
psql`SELECT * FROM posts`
.then(posts => console.log(posts));
// using async/await
async function main() {
let posts = await psql`SELECT * FROM posts`;
...
}
why
Wrapper using templates that promisifies the any-db library. Simple and easy to use sql queries, especially when using async/await.
license
MIT
0.1.0
8 years ago