Skip to content

sqlite: add tagged template #58748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

sqlite: add tagged template #58748

wants to merge 1 commit into from

Conversation

0hmX
Copy link
Contributor

@0hmX 0hmX commented Jun 18, 2025

Closes #57570

The current implementation is experimental and intended to gather early feedback on the proposed direction.

This initial approach introduces two new functions:

  • processSqlTemplate(): [the actual string interpolation logic.]
  • createSqlTag(): [a higher order function that stores the native db and returns another processSqlTemplate .]

Note: The API design is not final and is expected to evolve based on feedback.

Questions for Maintainers

  1. Is this direction a suitable foundation for solving the issue? Are there any alternative approaches I should consider?

As this is my first feature development for the project, any feedback on the code, approach, or contribution process would be greatly appreciated.

Here is my current plane for the usage

const {createSqlTag, DatabaseSync} = require("node:sqlite")

const db = new DatabaseSync(":memeory:")

const template = createSqlTag(db)

template`sql statement` // return the prepared statement

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Jun 18, 2025
@0hmX
Copy link
Contributor Author

0hmX commented Jun 18, 2025

looking forward to your answers cc @nodejs/sqlite

@0hmX 0hmX changed the title sqlite: add taged template to sqlite sqlite: add tagged template Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add template tags support to node:sqlite
2 participants