- Notifications
You must be signed in to change notification settings - Fork27
feat: add named params support#92
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: Bilux <i.bilux@gmail.com>
Signed-off-by: Bilux <i.bilux@gmail.com>
Signed-off-by: Bilux <i.bilux@gmail.com>
DallasHoffOct 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
sqlTag andnormalizeSql should probably just be combined into one function. I'd look into replacingsqlTag in the places it is used with thenormalizeSql implementation. I'd keep thesqlTag naming though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes, it would be better i think.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is looking really good so far.
What do you think about using exporttypeStatement={sql:string;params:unknown[]|Record<string,unknown>;}; The
Referenced from SQLite wasm: |
Signed-off-by: Bilux <i.bilux@gmail.com>
fc772d2 to17c2228CompareSigned-off-by: Bilux <i.bilux@gmail.com>
wip: testing the sqlite/wasm Bindable typing
|
We can also export the // Use the `normalizeNamedParams` helper functionawaitsql('INSERT INTO groceries (name) VALUES (:name)',normalizeNamedParams({name:'bread'}));// Or provide a valid binding object insteadawaitsql('INSERT INTO groceries (name) VALUES (:name)',{':name':'bread'}); This provide more flexibility, but may introduce some confusion. |
Hello,
This is a work-in-progress for#91 aiming to add support for named parameters.
I’ve added tests, and they’re all passing so far. However, the current implementation is not perfect (far from it, actually), there’s definitely room for improvement.
Any feedback or suggestions for a cleaner or more efficient approach would be very welcome.
Thank you.