@tursodatabase/serverless 0.1.0 → 0.1.1

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.
@@ -12,6 +12,20 @@ export declare class Statement {
12
12
  private session;
13
13
  private sql;
14
14
  constructor(sessionConfig: SessionConfig, sql: string);
15
+ /**
16
+ * Executes the prepared statement.
17
+ *
18
+ * @param args - Optional array of parameter values for the SQL statement
19
+ * @returns Promise resolving to the result of the statement
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const stmt = client.prepare("INSERT INTO users (name, email) VALUES (?, ?)");
24
+ * const result = await stmt.run(['John Doe', 'john.doe@example.com']);
25
+ * console.log(`Inserted user with ID ${result.lastInsertRowid}`);
26
+ * ```
27
+ */
28
+ run(args?: any[]): Promise<any>;
15
29
  /**
16
30
  * Execute the statement and return the first row.
17
31
  *
package/dist/statement.js CHANGED
@@ -14,6 +14,23 @@ export class Statement {
14
14
  this.session = new Session(sessionConfig);
15
15
  this.sql = sql;
16
16
  }
17
+ /**
18
+ * Executes the prepared statement.
19
+ *
20
+ * @param args - Optional array of parameter values for the SQL statement
21
+ * @returns Promise resolving to the result of the statement
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const stmt = client.prepare("INSERT INTO users (name, email) VALUES (?, ?)");
26
+ * const result = await stmt.run(['John Doe', 'john.doe@example.com']);
27
+ * console.log(`Inserted user with ID ${result.lastInsertRowid}`);
28
+ * ```
29
+ */
30
+ async run(args = []) {
31
+ const result = await this.session.execute(this.sql, args);
32
+ return { changes: result.rowsAffected, lastInsertRowid: result.lastInsertRowid };
33
+ }
17
34
  /**
18
35
  * Execute the statement and return the first row.
19
36
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tursodatabase/serverless",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",