@dockstat/sqlite-wrapper 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +3 -1
- package/package.json +7 -2
- package/query-builder/base.ts +0 -1
- package/query-builder/select.ts +1 -1
- package/query-builder/where.ts +0 -3
- package/types.ts +1 -0
package/index.ts
CHANGED
|
@@ -211,7 +211,7 @@ class DB {
|
|
|
211
211
|
tableName: string,
|
|
212
212
|
columns: string | Record<string, string> | TableSchema,
|
|
213
213
|
options?: TableOptions
|
|
214
|
-
):
|
|
214
|
+
): QueryBuilder<_T> {
|
|
215
215
|
const temp = options?.temporary ? 'TEMPORARY ' : ''
|
|
216
216
|
const ifNot = options?.ifNotExists ? 'IF NOT EXISTS ' : ''
|
|
217
217
|
const withoutRowId = options?.withoutRowId ? ' WITHOUT ROWID' : ''
|
|
@@ -276,6 +276,8 @@ class DB {
|
|
|
276
276
|
if (options?.comment) {
|
|
277
277
|
this.setTableComment(tableName, options.comment)
|
|
278
278
|
}
|
|
279
|
+
|
|
280
|
+
return this.table<_T>(tableName)
|
|
279
281
|
}
|
|
280
282
|
|
|
281
283
|
/**
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dockstat/sqlite-wrapper",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "A TypeScript wrapper around bun:sqlite with type-safe query building",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
7
7
|
"types": "./index.ts",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"index.ts",
|
|
10
|
+
"query-builder/**/*",
|
|
11
|
+
"README.md",
|
|
12
|
+
"types.ts"
|
|
13
|
+
],
|
|
9
14
|
"scripts": {
|
|
10
15
|
"dev": "bun build index.ts",
|
|
11
16
|
"lint": "biome lint .",
|
package/query-builder/base.ts
CHANGED
package/query-builder/select.ts
CHANGED
|
@@ -183,7 +183,7 @@ export class SelectQueryBuilder<
|
|
|
183
183
|
`Executing SELECT query - query: ${query}, params: ${JSON.stringify(params)}, hasJsonColumns: ${!!this.state.jsonColumns}`
|
|
184
184
|
)
|
|
185
185
|
const rows = this.getDb()
|
|
186
|
-
.prepare(query)
|
|
186
|
+
.prepare(query, params)
|
|
187
187
|
.all() as T[]
|
|
188
188
|
this.getLogger().debug(`Retrieved ${rows.length} rows from database`)
|
|
189
189
|
const transformed = this.transformRowsFromDb(rows)
|
package/query-builder/where.ts
CHANGED
|
@@ -206,9 +206,6 @@ export class WhereQueryBuilder<
|
|
|
206
206
|
throw new Error(`whereOp: operator "${op}" not supported`);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
// Remove any existing conditions for this column
|
|
210
|
-
this.removeExistingCondition(String(column));
|
|
211
|
-
|
|
212
209
|
// Handle null special-casing for IS / IS NOT and equality operators
|
|
213
210
|
if (
|
|
214
211
|
(value === null || value === undefined) &&
|
package/types.ts
CHANGED