-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsqlite.ts
More file actions
86 lines (74 loc) · 2.25 KB
/
sqlite.ts
File metadata and controls
86 lines (74 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../resource';
import * as Core from '../core';
import * as Shared from './shared';
/**
* Vals access a shared SQLite database
*/
export class Sqlite extends APIResource {
/**
* Execute a batch of SQLite statements and return results for all of them
*/
batch(body: SqliteBatchParams, options?: Core.RequestOptions): Core.APIPromise<SqliteBatchResponse> {
return this._client.post('/v1/sqlite/batch', { body, ...options });
}
/**
* Execute a single SQLite statement and return results
*/
execute(body: SqliteExecuteParams, options?: Core.RequestOptions): Core.APIPromise<Shared.ResultSet> {
return this._client.post('/v1/sqlite/execute', { body, ...options });
}
}
/**
* Array of results from the statements executed
*/
export type SqliteBatchResponse = Array<Shared.ResultSet>;
export interface SqliteBatchParams {
statements: Array<string | SqliteBatchParams.ParameterizedQuery>;
mode?: 'write' | 'read' | 'deferred';
}
export namespace SqliteBatchParams {
/**
* A parameterized SQL query. See
* https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference
*/
export interface ParameterizedQuery {
/**
* List of arguments to be used in the given statement
*/
args: Array<unknown> | Record<string, unknown>;
/**
* SQL statement, with ? placeholders for arguments
*/
sql: string;
}
}
export interface SqliteExecuteParams {
/**
* Simple SQL statement to run in SQLite
*/
statement: string | SqliteExecuteParams.ParameterizedQuery;
}
export namespace SqliteExecuteParams {
/**
* A parameterized SQL query. See
* https://docs.turso.tech/sdk/ts/reference#batch-transactions for reference
*/
export interface ParameterizedQuery {
/**
* List of arguments to be used in the given statement
*/
args: Array<unknown> | Record<string, unknown>;
/**
* SQL statement, with ? placeholders for arguments
*/
sql: string;
}
}
export declare namespace Sqlite {
export {
type SqliteBatchResponse as SqliteBatchResponse,
type SqliteBatchParams as SqliteBatchParams,
type SqliteExecuteParams as SqliteExecuteParams,
};
}