Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beerose/tag-sql
💥Build sql queries for mysqljs in a safe and comfortable way
https://github.com/beerose/tag-sql
Last synced: about 1 month ago
JSON representation
💥Build sql queries for mysqljs in a safe and comfortable way
- Host: GitHub
- URL: https://github.com/beerose/tag-sql
- Owner: beerose
- License: mit
- Created: 2019-05-04T14:09:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-05T10:16:01.000Z (over 5 years ago)
- Last Synced: 2024-10-18T12:55:37.636Z (2 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/tag-sql
- Size: 101 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tag-sql
![npm](https://img.shields.io/npm/v/tag-sql.svg)
![npm bundle size](https://img.shields.io/bundlephobia/min/tag-sql.svg?color=purple)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)Build sql queries for [mysqljs](https://github.com/mysqljs/mysql) in a safe and comfortable way 💥
---
**tag-sql** allows to pass query parameters directly to the query string.
It's the alternative for parametrized queries.```js
sql`SELECT * FROM users WHERE id = ${userId};`;
```It'll be converted to the the object of type `QueryOptions` accepted by **mysqljs**.
```js
{
sql: "SELECT * FROM users WHERE id = ?;",
values: [userId],
}
```## Installation
```sh
yarn add tag-sql --dev
```## Local Development
Below is a list of commands you will probably find useful.
### `npm start` or `yarn start`
Runs the project in development/watch mode. Project will be rebuilt upon changes.
### `npm run build` or `yarn build`
Bundles the package to the `dist` folder.
The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).### `npm test` or `yarn test`
Runs the test watcher (Jest) in an interactive mode.
By default, runs tests related to files changed since the last commit.