bun-types 1.3.5 → 1.3.6-canary.20251220T140617
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/docs/runtime/sqlite.mdx +1 -1
- package/package.json +1 -1
- package/sqlite.d.ts +17 -16
package/docs/runtime/sqlite.mdx
CHANGED
|
@@ -303,7 +303,7 @@ Internally, this calls [`sqlite3_reset`](https://www.sqlite.org/capi3ref.html#sq
|
|
|
303
303
|
|
|
304
304
|
### `.run()`
|
|
305
305
|
|
|
306
|
-
Use `.run()` to run a query and get back
|
|
306
|
+
Use `.run()` to run a query and get back an object with execution metadata. This is useful for schema-modifying queries (e.g. `CREATE TABLE`) or bulk write operations.
|
|
307
307
|
|
|
308
308
|
```ts db.ts icon="/icons/typescript.svg" highlight={2}
|
|
309
309
|
const query = db.query(`create table foo;`);
|
package/package.json
CHANGED
package/sqlite.d.ts
CHANGED
|
@@ -154,12 +154,6 @@ declare module "bun:sqlite" {
|
|
|
154
154
|
* | `bigint` | `INTEGER` |
|
|
155
155
|
* | `null` | `NULL` |
|
|
156
156
|
*
|
|
157
|
-
* @example
|
|
158
|
-
* ```ts
|
|
159
|
-
* db.run("CREATE TABLE foo (bar TEXT)");
|
|
160
|
-
* db.run("INSERT INTO foo VALUES (?)", ["baz"]);
|
|
161
|
-
* ```
|
|
162
|
-
*
|
|
163
157
|
* Useful for queries like:
|
|
164
158
|
* - `CREATE TABLE`
|
|
165
159
|
* - `INSERT INTO`
|
|
@@ -180,8 +174,14 @@ declare module "bun:sqlite" {
|
|
|
180
174
|
*
|
|
181
175
|
* @param sql The SQL query to run
|
|
182
176
|
* @param bindings Optional bindings for the query
|
|
177
|
+
* @returns A `Changes` object with `changes` and `lastInsertRowid` properties
|
|
183
178
|
*
|
|
184
|
-
* @
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* db.run("CREATE TABLE foo (bar TEXT)");
|
|
182
|
+
* db.run("INSERT INTO foo VALUES (?)", ["baz"]);
|
|
183
|
+
* // => { changes: 1, lastInsertRowid: 1 }
|
|
184
|
+
* ```
|
|
185
185
|
*/
|
|
186
186
|
run<ParamsType extends SQLQueryBindings[]>(sql: string, ...bindings: ParamsType[]): Changes;
|
|
187
187
|
|
|
@@ -670,18 +670,19 @@ declare module "bun:sqlite" {
|
|
|
670
670
|
* Execute the prepared statement.
|
|
671
671
|
*
|
|
672
672
|
* @param params optional values to bind to the statement. If omitted, the statement is run with the last bound values or no parameters if there are none.
|
|
673
|
+
* @returns A `Changes` object with `changes` and `lastInsertRowid` properties
|
|
673
674
|
*
|
|
674
675
|
* @example
|
|
675
676
|
* ```ts
|
|
676
|
-
* const
|
|
677
|
-
*
|
|
678
|
-
* // =>
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
* // =>
|
|
677
|
+
* const insert = db.prepare("INSERT INTO users (name) VALUES (?)");
|
|
678
|
+
* insert.run("Alice");
|
|
679
|
+
* // => { changes: 1, lastInsertRowid: 1 }
|
|
680
|
+
* insert.run("Bob");
|
|
681
|
+
* // => { changes: 1, lastInsertRowid: 2 }
|
|
682
|
+
*
|
|
683
|
+
* const update = db.prepare("UPDATE users SET name = ? WHERE id = ?");
|
|
684
|
+
* update.run("Charlie", 1);
|
|
685
|
+
* // => { changes: 1, lastInsertRowid: 2 }
|
|
685
686
|
* ```
|
|
686
687
|
*
|
|
687
688
|
* The following types can be used when binding parameters:
|