-
Notifications
You must be signed in to change notification settings - Fork 1
Implement async Database API (breaking change) #7
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -238,7 +238,7 @@ export class NodeQuery { | |||||||||||||||||||||
| * console.log(`Found ${results.length} active jobs`); | ||||||||||||||||||||||
| * ``` | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| exec(): Node[] { | ||||||||||||||||||||||
| async exec(): Promise<Node[]> { | ||||||||||||||||||||||
| const sql = this.buildSQL(); | ||||||||||||||||||||||
| const params = this.buildParams(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -277,10 +277,10 @@ export class NodeQuery { | |||||||||||||||||||||
| * } | ||||||||||||||||||||||
| * ``` | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| first(): Node | null { | ||||||||||||||||||||||
| async first(): Promise<Node | null> { | ||||||||||||||||||||||
| const original = this.limitValue; | ||||||||||||||||||||||
| this.limitValue = 1; | ||||||||||||||||||||||
| const results = this.exec(); | ||||||||||||||||||||||
| const results = await this.exec(); | ||||||||||||||||||||||
| this.limitValue = original; | ||||||||||||||||||||||
| return results.length > 0 ? results[0] : null; | ||||||||||||||||||||||
|
Comment on lines
+283
to
285
|
||||||||||||||||||||||
| const results = await this.exec(); | |
| this.limitValue = original; | |
| return results.length > 0 ? results[0] : null; | |
| try { | |
| const results = await this.exec(); | |
| return results.length > 0 ? results[0] : null; | |
| } finally { | |
| this.limitValue = original; | |
| } |
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.
dropIndex()interpolatesindexNamedirectly into theDROP INDEXstatement. Since identifiers can’t be parameterized, this should validate/sanitizeindexName(e.g., allow only[A-Za-z0-9_]+and/or enforce anidx_merge_prefix) to avoid SQL injection via this public API.