tag-sql
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

tag-sql

npm npm bundle size

Build sql queries for mysqljs 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.

const userId = 1;
sql`SELECT * FROM users WHERE id = ${userId};`;

It'll be converted to the the object of type QueryOptions that is accepted by mysqljs.

{
  sql: SELECT * FROM users WHERE id = ?;,
  values: [userId],
}

Instalation

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.

Package Sidebar

Install

npm i tag-sql

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

28.3 kB

Total Files

24

Last publish

Collaborators

  • anemone