{"id":15690593,"url":"https://github.com/aldy505/sql-dsl","last_synced_at":"2025-07-12T01:03:00.084Z","repository":{"id":57368186,"uuid":"384926547","full_name":"aldy505/sql-dsl","owner":"aldy505","description":"SQL as template literal (for a lot of stuff)","archived":false,"fork":false,"pushed_at":"2024-02-11T13:02:52.000Z","size":161,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T03:04:42.788Z","etag":null,"topics":["database","dsl","mysql","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aldy505.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"aldy505","ko_fi":"aldy505","liberapay":"aldy505"}},"created_at":"2021-07-11T11:03:47.000Z","updated_at":"2023-01-24T13:06:17.000Z","dependencies_parsed_at":"2024-10-23T22:59:38.553Z","dependency_job_id":"f8abab03-d794-425a-b296-7daf31ec59e9","html_url":"https://github.com/aldy505/sql-dsl","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.3125,"last_synced_commit":"8658bd38f7eb78c811c103745099902719b145cb"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aldy505/sql-dsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldy505%2Fsql-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldy505%2Fsql-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldy505%2Fsql-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldy505%2Fsql-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aldy505","download_url":"https://codeload.github.com/aldy505/sql-dsl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldy505%2Fsql-dsl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922786,"owners_count":23683690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","dsl","mysql","postgresql","sql"],"created_at":"2024-10-03T18:12:29.882Z","updated_at":"2025-07-12T01:02:59.661Z","avatar_url":"https://github.com/aldy505.png","language":"TypeScript","funding_links":["https://github.com/sponsors/aldy505","https://ko-fi.com/aldy505","https://liberapay.com/aldy505"],"categories":[],"sub_categories":[],"readme":"# SQL DSL for your Node App\n\n[![npm](https://img.shields.io/npm/v/sql-dsl?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/sql-dsl?style=flat-square) ![npm](https://img.shields.io/npm/dm/sql-dsl?style=flat-square)](https://www.npmjs.com/package/sql-dsl) [![Codecov](https://img.shields.io/codecov/c/github/aldy505/sql-dsl?style=flat-square)](https://codecov.io/gh/aldy505/sql-dsl) [![GitHub branch checks state](https://img.shields.io/github/checks-status/aldy505/sql-dsl/master?style=flat-square)](https://github.com/aldy505/sql-dsl/actions) [![CodeFactor](https://www.codefactor.io/repository/github/aldy505/sql-dsl/badge)](https://www.codefactor.io/repository/github/aldy505/sql-dsl) [![GitHub](https://img.shields.io/github/license/aldy505/sql-dsl?style=flat-square)](https://github.com/aldy505/sql-dsl/blob/master/LICENSE)\n\nBased on an idea from [@ronnygunawan](https://github.com/ronnygunawan). This was supposed to be a challenge for someone else, but I thought, why not? Lol.\n\nAs always:\n* Supports CJS and ESM\n* Built-in typings\n* No external dependencies\n\n```bash\nnpm install sql-dsl\n```\n\n## What this does?\n\nThis outputs simple SQL query \u0026 argument object from your template literal string.\n\n```js\nimport { sql } from 'sql-dsl'\n\nconst query = sql`INSERT INTO users (name, email, age) VALUES (${`Thomas Worgdjik`}, ${`thom@thunder.zn`}, ${30})`\n\n// {\n//   sql: 'INSERT INTO users (name, email, age) VALUES ($1, $2, $3)',\n//   values: ['Thomas Worgdjik', 'thom@thunder.zn', 30]\n// }\n\n// Oh, you work with MySQL instead of Postgres? Sure!\n\nconst postgres = query.formatQuestion()\n\n// {\n//   sql: 'INSERT INTO users (name, email, age) VALUES (?, ?, ?)',\n//   values: ['Thomas Worgdjik', 'thom@thunder.zn', 30]\n// }\n\n// More elegant way to do that is this:\nconst query = sql`INSERT INTO users (name, email, age) VALUES (${`Thomas Worgdjik`}, ${`thom@thunder.zn`}, ${30})`.formatQuestion()\n\n// Your database work with colon notation? Something like :1 :2 etc? No problem.\n\nconst colon = query.formatColon()\n\n// {\n//   sql: 'INSERT INTO users (name, email, age) VALUES (:1, :2, :3)',\n//   values: ['Thomas Worgdjik', 'thom@thunder.zn', 30]\n// }\n\n// Your database work with @p notation? Yeah, we can do that.\n\nconst atp = query.formatAtP()\n\n// {\n//   sql: 'INSERT INTO users (name, email, age) VALUES (@p1, @p2, @p3)',\n//   values: ['Thomas Worgdjik', 'thom@thunder.zn', 30]\n// }\n```\n\nSee more examples with the database drivers on [examples](./examples).\n\n## Hey, I want a feature!\n\nWant more features? Open something up on [issues](https://github.com/aldy505/sql-dsl). To be honest, I don't know what else to add.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldy505%2Fsql-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faldy505%2Fsql-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldy505%2Fsql-dsl/lists"}