rado 0.1.53 → 0.1.54
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/dist/define/Column.d.ts +58 -58
- package/dist/define/Cursor.d.ts +86 -85
- package/dist/define/Cursor.js +3 -0
- package/dist/define/Expr.d.ts +154 -154
- package/dist/define/Fields.d.ts +13 -13
- package/dist/define/Functions.d.ts +5 -5
- package/dist/define/Id.d.ts +3 -3
- package/dist/define/Index.d.ts +17 -17
- package/dist/define/Ops.d.ts +7 -7
- package/dist/define/OrderBy.d.ts +9 -9
- package/dist/define/Param.d.ts +15 -15
- package/dist/define/Query.d.ts +109 -109
- package/dist/define/Schema.d.ts +18 -18
- package/dist/define/Selection.d.ts +20 -20
- package/dist/define/Table.d.ts +62 -62
- package/dist/define/Target.d.ts +38 -38
- package/dist/define/Update.d.ts +4 -4
- package/dist/driver/better-sqlite3.d.ts +15 -15
- package/dist/driver/bun-sqlite.d.ts +18 -18
- package/dist/driver/sql.js.d.ts +15 -15
- package/dist/driver/sqlite3.d.ts +18 -18
- package/dist/index.d.ts +21 -21
- package/dist/lib/Driver.d.ts +110 -110
- package/dist/lib/Formatter.d.ts +78 -78
- package/dist/lib/Sanitizer.d.ts +5 -5
- package/dist/lib/SqlError.d.ts +3 -3
- package/dist/lib/Statement.d.ts +33 -33
- package/dist/sqlite/SqliteFormatter.d.ts +11 -11
- package/dist/sqlite/SqliteFunctions.d.ts +165 -165
- package/dist/sqlite/SqliteSchema.d.ts +25 -25
- package/dist/sqlite.d.ts +2 -2
- package/package.json +60 -60
- package/dist/CPU.20230126.092143.12244.0.001.cpuprofile +0 -1
- package/dist/Column.d.ts +0 -54
- package/dist/Column.js +0 -63
- package/dist/Cursor.d.ts +0 -77
- package/dist/Cursor.js +0 -221
- package/dist/Driver.d.ts +0 -89
- package/dist/Driver.js +0 -262
- package/dist/Expr.d.ts +0 -149
- package/dist/Expr.js +0 -284
- package/dist/Fields.d.ts +0 -11
- package/dist/Fields.js +0 -0
- package/dist/Formatter.d.ts +0 -55
- package/dist/Formatter.js +0 -496
- package/dist/Functions.d.ts +0 -7
- package/dist/Functions.js +0 -11
- package/dist/Id.d.ts +0 -3
- package/dist/Id.js +0 -0
- package/dist/Ops.d.ts +0 -8
- package/dist/Ops.js +0 -45
- package/dist/OrderBy.d.ts +0 -9
- package/dist/OrderBy.js +0 -9
- package/dist/Param.d.ts +0 -15
- package/dist/Param.js +0 -18
- package/dist/Query.d.ts +0 -107
- package/dist/Query.js +0 -74
- package/dist/Sanitizer.d.ts +0 -4
- package/dist/Sanitizer.js +0 -0
- package/dist/Schema.d.ts +0 -23
- package/dist/Schema.js +0 -60
- package/dist/Selection.d.ts +0 -20
- package/dist/Selection.js +0 -7
- package/dist/Statement.d.ts +0 -57
- package/dist/Statement.js +0 -184
- package/dist/Table.d.ts +0 -56
- package/dist/Table.js +0 -104
- package/dist/Target.d.ts +0 -30
- package/dist/Target.js +0 -37
- package/dist/Update.d.ts +0 -4
- package/dist/Update.js +0 -0
- package/dist/lib/Column.d.ts +0 -57
- package/dist/lib/Column.js +0 -63
- package/dist/lib/Cursor.d.ts +0 -79
- package/dist/lib/Cursor.js +0 -231
- package/dist/lib/Expr.d.ts +0 -154
- package/dist/lib/Expr.js +0 -284
- package/dist/lib/Fields.d.ts +0 -13
- package/dist/lib/Fields.js +0 -0
- package/dist/lib/Functions.d.ts +0 -5
- package/dist/lib/Functions.js +0 -11
- package/dist/lib/Id.d.ts +0 -3
- package/dist/lib/Id.js +0 -0
- package/dist/lib/Index.d.ts +0 -17
- package/dist/lib/Index.js +0 -20
- package/dist/lib/Ops.d.ts +0 -8
- package/dist/lib/Ops.js +0 -45
- package/dist/lib/OrderBy.d.ts +0 -9
- package/dist/lib/OrderBy.js +0 -9
- package/dist/lib/Param.d.ts +0 -20
- package/dist/lib/Param.js +0 -27
- package/dist/lib/Query.d.ts +0 -109
- package/dist/lib/Query.js +0 -74
- package/dist/lib/Schema.d.ts +0 -18
- package/dist/lib/Schema.js +0 -67
- package/dist/lib/Selection.d.ts +0 -20
- package/dist/lib/Selection.js +0 -7
- package/dist/lib/Table.d.ts +0 -62
- package/dist/lib/Table.js +0 -130
- package/dist/lib/Target.d.ts +0 -30
- package/dist/lib/Target.js +0 -37
- package/dist/lib/Update.d.ts +0 -4
- package/dist/lib/Update.js +0 -0
- package/dist/sqlite/index.d.ts +0 -2
- package/dist/sqlite/index.js +0 -3
- package/dist/src/driver/better-sqlite3.js +0 -49
- package/dist/src/driver/sql.js.js +0 -66
- package/dist/src/driver/sqlite3.js +0 -87
- package/dist/src/index.js +0 -24
- package/dist/src/lib/Column.js +0 -63
- package/dist/src/lib/Cursor.js +0 -231
- package/dist/src/lib/Driver.js +0 -316
- package/dist/src/lib/Expr.js +0 -284
- package/dist/src/lib/Fields.js +0 -0
- package/dist/src/lib/Formatter.js +0 -625
- package/dist/src/lib/Functions.js +0 -11
- package/dist/src/lib/Id.js +0 -0
- package/dist/src/lib/Index.js +0 -20
- package/dist/src/lib/Ops.js +0 -45
- package/dist/src/lib/OrderBy.js +0 -9
- package/dist/src/lib/Param.js +0 -27
- package/dist/src/lib/Query.js +0 -74
- package/dist/src/lib/Sanitizer.js +0 -0
- package/dist/src/lib/Schema.js +0 -67
- package/dist/src/lib/Selection.js +0 -7
- package/dist/src/lib/Statement.js +0 -103
- package/dist/src/lib/Table.js +0 -130
- package/dist/src/lib/Target.js +0 -37
- package/dist/src/lib/Update.js +0 -0
- package/dist/src/sqlite/SqliteFormatter.js +0 -67
- package/dist/src/sqlite/SqliteFunctions.js +0 -146
- package/dist/src/sqlite/SqliteSchema.js +0 -47
- package/dist/src/sqlite.js +0 -3
- package/dist/test/DbSuite.js +0 -28
- package/dist/test/TSTestTypes.js +0 -6
- package/dist/test/TestBasic.js +0 -172
- package/dist/test/TestExtend.js +0 -68
- package/dist/test/TestFts5.js +0 -34
- package/dist/test/TestFunctions.js +0 -28
- package/dist/test/TestJoins.js +0 -34
- package/dist/test/TestJson.js +0 -33
- package/dist/test/TestPrepare.js +0 -27
- package/dist/test/TestRawSql.js +0 -31
- package/dist/test/TestSchema.js +0 -69
- package/dist/test/TestSubQueries.js +0 -79
- package/dist/test/TestTransaction.js +0 -54
- package/dist/test/TestUpdate.js +0 -95
- package/dist/test/index.js +0 -14
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/// <reference types="bun-types" />
|
|
2
|
-
import type { Database } from 'bun:sqlite';
|
|
3
|
-
import { SchemaInstructions } from '../define/Schema';
|
|
4
|
-
import { Driver } from '../lib/Driver';
|
|
5
|
-
import { Statement } from '../lib/Statement';
|
|
6
|
-
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
7
|
-
export declare class BunSqliteDriver extends Driver.Sync {
|
|
8
|
-
db: Database;
|
|
9
|
-
tableData: (tableName: string) => Array<SqliteSchema.Column>;
|
|
10
|
-
indexData: (tableName: string) => Array<SqliteSchema.Index>;
|
|
11
|
-
lastChanges: () => {
|
|
12
|
-
rowsAffected: number;
|
|
13
|
-
};
|
|
14
|
-
constructor(db: Database);
|
|
15
|
-
prepareStatement(stmt: Statement): Driver.Sync.PreparedStatement;
|
|
16
|
-
schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
17
|
-
}
|
|
18
|
-
export declare function connect(db: Database): BunSqliteDriver;
|
|
1
|
+
/// <reference types="bun-types" />
|
|
2
|
+
import type { Database } from 'bun:sqlite';
|
|
3
|
+
import { SchemaInstructions } from '../define/Schema';
|
|
4
|
+
import { Driver } from '../lib/Driver';
|
|
5
|
+
import { Statement } from '../lib/Statement';
|
|
6
|
+
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
7
|
+
export declare class BunSqliteDriver extends Driver.Sync {
|
|
8
|
+
db: Database;
|
|
9
|
+
tableData: (tableName: string) => Array<SqliteSchema.Column>;
|
|
10
|
+
indexData: (tableName: string) => Array<SqliteSchema.Index>;
|
|
11
|
+
lastChanges: () => {
|
|
12
|
+
rowsAffected: number;
|
|
13
|
+
};
|
|
14
|
+
constructor(db: Database);
|
|
15
|
+
prepareStatement(stmt: Statement): Driver.Sync.PreparedStatement;
|
|
16
|
+
schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function connect(db: Database): BunSqliteDriver;
|
package/dist/driver/sql.js.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Database } from 'sql.js';
|
|
2
|
-
import { SchemaInstructions } from '../define/Schema';
|
|
3
|
-
import { Driver } from '../lib/Driver';
|
|
4
|
-
import { Statement } from '../lib/Statement';
|
|
5
|
-
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
6
|
-
export declare class SqlJsDriver extends Driver.Sync {
|
|
7
|
-
db: Database;
|
|
8
|
-
tableData: (tableName: string) => Array<SqliteSchema.Column>;
|
|
9
|
-
indexData: (tableName: string) => Array<SqliteSchema.Index>;
|
|
10
|
-
constructor(db: Database);
|
|
11
|
-
prepareStatement(stmt: Statement, discardAfter: boolean): Driver.Sync.PreparedStatement;
|
|
12
|
-
schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
13
|
-
export(): Uint8Array;
|
|
14
|
-
}
|
|
15
|
-
export declare function connect(db: Database): SqlJsDriver;
|
|
1
|
+
import type { Database } from 'sql.js';
|
|
2
|
+
import { SchemaInstructions } from '../define/Schema';
|
|
3
|
+
import { Driver } from '../lib/Driver';
|
|
4
|
+
import { Statement } from '../lib/Statement';
|
|
5
|
+
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
6
|
+
export declare class SqlJsDriver extends Driver.Sync {
|
|
7
|
+
db: Database;
|
|
8
|
+
tableData: (tableName: string) => Array<SqliteSchema.Column>;
|
|
9
|
+
indexData: (tableName: string) => Array<SqliteSchema.Index>;
|
|
10
|
+
constructor(db: Database);
|
|
11
|
+
prepareStatement(stmt: Statement, discardAfter: boolean): Driver.Sync.PreparedStatement;
|
|
12
|
+
schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
13
|
+
export(): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function connect(db: Database): SqlJsDriver;
|
package/dist/driver/sqlite3.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { Database } from 'sqlite3';
|
|
2
|
-
import { Query } from '../define/Query';
|
|
3
|
-
import { SchemaInstructions } from '../define/Schema';
|
|
4
|
-
import { Driver } from '../lib/Driver';
|
|
5
|
-
import { Statement } from '../lib/Statement';
|
|
6
|
-
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
7
|
-
export declare class Sqlite3Driver extends Driver.Async {
|
|
8
|
-
private db;
|
|
9
|
-
lock: Promise<void> | undefined;
|
|
10
|
-
tableData: (tableName: string) => Promise<Array<SqliteSchema.Column>>;
|
|
11
|
-
indexData: (tableName: string) => Promise<Array<SqliteSchema.Index>>;
|
|
12
|
-
constructor(db: Database);
|
|
13
|
-
executeQuery<T>(query: Query<T>, stmt?: Driver.Async.PreparedStatement, params?: any[] | undefined): Promise<T>;
|
|
14
|
-
prepareStatement(stmt: Statement): Driver.Async.PreparedStatement;
|
|
15
|
-
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
16
|
-
isolate(): [connection: Driver.Async, release: () => Promise<void>];
|
|
17
|
-
}
|
|
18
|
-
export declare function connect(db: Database): Sqlite3Driver;
|
|
1
|
+
import type { Database } from 'sqlite3';
|
|
2
|
+
import { Query } from '../define/Query';
|
|
3
|
+
import { SchemaInstructions } from '../define/Schema';
|
|
4
|
+
import { Driver } from '../lib/Driver';
|
|
5
|
+
import { Statement } from '../lib/Statement';
|
|
6
|
+
import { SqliteSchema } from '../sqlite/SqliteSchema';
|
|
7
|
+
export declare class Sqlite3Driver extends Driver.Async {
|
|
8
|
+
private db;
|
|
9
|
+
lock: Promise<void> | undefined;
|
|
10
|
+
tableData: (tableName: string) => Promise<Array<SqliteSchema.Column>>;
|
|
11
|
+
indexData: (tableName: string) => Promise<Array<SqliteSchema.Index>>;
|
|
12
|
+
constructor(db: Database);
|
|
13
|
+
executeQuery<T>(query: Query<T>, stmt?: Driver.Async.PreparedStatement, params?: any[] | undefined): Promise<T>;
|
|
14
|
+
prepareStatement(stmt: Statement): Driver.Async.PreparedStatement;
|
|
15
|
+
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
16
|
+
isolate(): [connection: Driver.Async, release: () => Promise<void>];
|
|
17
|
+
}
|
|
18
|
+
export declare function connect(db: Database): Sqlite3Driver;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export * from './define/Column';
|
|
2
|
-
export * from './define/Cursor';
|
|
3
|
-
export * from './define/Expr';
|
|
4
|
-
export * from './define/Fields';
|
|
5
|
-
export * from './define/Functions';
|
|
6
|
-
export * from './define/Id';
|
|
7
|
-
export * from './define/Index';
|
|
8
|
-
export * from './define/Ops';
|
|
9
|
-
export * from './define/OrderBy';
|
|
10
|
-
export * from './define/Param';
|
|
11
|
-
export * from './define/Query';
|
|
12
|
-
export * from './define/Schema';
|
|
13
|
-
export * from './define/Selection';
|
|
14
|
-
export * from './define/Table';
|
|
15
|
-
export * from './define/Target';
|
|
16
|
-
export * from './define/Update';
|
|
17
|
-
export type { Driver } from './lib/Driver';
|
|
18
|
-
export type { FormatContext, Formatter } from './lib/Formatter';
|
|
19
|
-
export type { Sanitizer } from './lib/Sanitizer';
|
|
20
|
-
export * from './lib/SqlError';
|
|
21
|
-
export type { Statement } from './lib/Statement';
|
|
1
|
+
export * from './define/Column';
|
|
2
|
+
export * from './define/Cursor';
|
|
3
|
+
export * from './define/Expr';
|
|
4
|
+
export * from './define/Fields';
|
|
5
|
+
export * from './define/Functions';
|
|
6
|
+
export * from './define/Id';
|
|
7
|
+
export * from './define/Index';
|
|
8
|
+
export * from './define/Ops';
|
|
9
|
+
export * from './define/OrderBy';
|
|
10
|
+
export * from './define/Param';
|
|
11
|
+
export * from './define/Query';
|
|
12
|
+
export * from './define/Schema';
|
|
13
|
+
export * from './define/Selection';
|
|
14
|
+
export * from './define/Table';
|
|
15
|
+
export * from './define/Target';
|
|
16
|
+
export * from './define/Update';
|
|
17
|
+
export type { Driver } from './lib/Driver';
|
|
18
|
+
export type { FormatContext, Formatter } from './lib/Formatter';
|
|
19
|
+
export type { Sanitizer } from './lib/Sanitizer';
|
|
20
|
+
export * from './lib/SqlError';
|
|
21
|
+
export type { Statement } from './lib/Statement';
|
package/dist/lib/Driver.d.ts
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { Cursor } from '../define/Cursor';
|
|
2
|
-
import { Expr } from '../define/Expr';
|
|
3
|
-
import { Query } from '../define/Query';
|
|
4
|
-
import { SchemaInstructions } from '../define/Schema';
|
|
5
|
-
import { Table } from '../define/Table';
|
|
6
|
-
import { Formatter } from './Formatter';
|
|
7
|
-
import { Statement } from './Statement';
|
|
8
|
-
declare class Callable extends Function {
|
|
9
|
-
constructor(fn: Function);
|
|
10
|
-
}
|
|
11
|
-
declare abstract class DriverBase extends Callable {
|
|
12
|
-
formatter: Formatter;
|
|
13
|
-
constructor(formatter: Formatter);
|
|
14
|
-
compile<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): [Query<T>, Statement];
|
|
15
|
-
all(...args: Array<any>): any;
|
|
16
|
-
get(...args: Array<any>): any;
|
|
17
|
-
sql(strings: TemplateStringsArray, ...params: Array<any>): Cursor<unknown>;
|
|
18
|
-
executeTemplate(expectedReturn: Query.RawReturn, strings: TemplateStringsArray, ...params: Array<any>): any;
|
|
19
|
-
abstract executeQuery(query: Query<any>): any;
|
|
20
|
-
}
|
|
21
|
-
type ParamTypes<Params extends [...any[]]> = {
|
|
22
|
-
[K in keyof Params]: Params[K] extends Expr<infer T> ? T : never;
|
|
23
|
-
} & {
|
|
24
|
-
length: Params['length'];
|
|
25
|
-
};
|
|
26
|
-
interface SyncDriver {
|
|
27
|
-
<T>(query: Cursor<T>): T;
|
|
28
|
-
<T>(...queries: Array<Cursor<any>>): T;
|
|
29
|
-
(strings: TemplateStringsArray, ...values: any[]): any;
|
|
30
|
-
}
|
|
31
|
-
declare abstract class SyncDriver extends DriverBase {
|
|
32
|
-
transactionId: number;
|
|
33
|
-
abstract prepareStatement(stmt: Statement, discardAfter: boolean): SyncPreparedStatement;
|
|
34
|
-
abstract schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
35
|
-
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => R;
|
|
36
|
-
migrateSchema(...tables: Array<Table<any>>): unknown;
|
|
37
|
-
executeQuery<T>(query: Query<T>, stmt?: SyncPreparedStatement, params?: Array<any>): T;
|
|
38
|
-
all<T>(cursor: Cursor.SelectSingle<T>): Array<T>;
|
|
39
|
-
all<T>(cursor: Cursor<T>): T;
|
|
40
|
-
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Array<T>;
|
|
41
|
-
get<T>(cursor: Cursor.SelectMultiple<T>): T | null;
|
|
42
|
-
get<T>(cursor: Cursor<T>): T;
|
|
43
|
-
get<T>(strings: TemplateStringsArray, ...params: Array<any>): T;
|
|
44
|
-
iterate<T>(cursor: Cursor.SelectMultiple<T>): Iterable<T>;
|
|
45
|
-
transaction<T>(run: (query: SyncDriver) => T): T;
|
|
46
|
-
toAsync(): SyncWrapper;
|
|
47
|
-
}
|
|
48
|
-
interface SyncPreparedStatement {
|
|
49
|
-
run(params?: Array<any>): {
|
|
50
|
-
rowsAffected: number;
|
|
51
|
-
};
|
|
52
|
-
iterate<T>(params?: Array<any>): Iterable<T>;
|
|
53
|
-
all<T>(params?: Array<any>): Array<T>;
|
|
54
|
-
get<T>(params?: Array<any>): T;
|
|
55
|
-
execute(params?: Array<any>): void;
|
|
56
|
-
}
|
|
57
|
-
interface AsyncDriver {
|
|
58
|
-
<T>(query: Cursor<T>): Promise<T>;
|
|
59
|
-
<T>(...queries: Array<Cursor<any>>): Promise<T>;
|
|
60
|
-
(strings: TemplateStringsArray, ...values: any[]): Promise<any>;
|
|
61
|
-
}
|
|
62
|
-
declare abstract class AsyncDriver extends DriverBase {
|
|
63
|
-
transactionId: number;
|
|
64
|
-
abstract isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
65
|
-
abstract prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
66
|
-
abstract schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
67
|
-
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => Promise<R>;
|
|
68
|
-
migrateSchema(...tables: Array<Table<any>>): Promise<unknown>;
|
|
69
|
-
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
70
|
-
all<T>(cursor: Cursor.SelectSingle<T>): Promise<Array<T>>;
|
|
71
|
-
all<T>(cursor: Cursor<T>): Promise<T>;
|
|
72
|
-
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<Array<T>>;
|
|
73
|
-
get<T>(cursor: Cursor.SelectMultiple<T>): Promise<T | null>;
|
|
74
|
-
get<T>(cursor: Cursor<T>): Promise<T>;
|
|
75
|
-
get<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<T>;
|
|
76
|
-
iterate<T>(cursor: Cursor.SelectMultiple<T>): AsyncIterable<T>;
|
|
77
|
-
transaction<T>(run: (query: AsyncDriver) => T): Promise<T>;
|
|
78
|
-
}
|
|
79
|
-
declare class SyncWrapper extends AsyncDriver {
|
|
80
|
-
private sync;
|
|
81
|
-
lock: Promise<void> | undefined;
|
|
82
|
-
constructor(sync: SyncDriver);
|
|
83
|
-
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
84
|
-
prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
85
|
-
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
86
|
-
isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
87
|
-
}
|
|
88
|
-
interface AsyncPreparedStatement {
|
|
89
|
-
run(params?: Array<any>): Promise<{
|
|
90
|
-
rowsAffected: number;
|
|
91
|
-
}>;
|
|
92
|
-
iterate<T>(params?: Array<any>): AsyncIterable<T>;
|
|
93
|
-
all<T>(params?: Array<any>): Promise<Array<T>>;
|
|
94
|
-
get<T>(params?: Array<any>): Promise<T>;
|
|
95
|
-
execute(params?: Array<any>): Promise<void>;
|
|
96
|
-
}
|
|
97
|
-
export type Driver = SyncDriver | AsyncDriver;
|
|
98
|
-
export declare namespace Driver {
|
|
99
|
-
type Sync = SyncDriver;
|
|
100
|
-
const Sync: typeof SyncDriver;
|
|
101
|
-
namespace Sync {
|
|
102
|
-
type PreparedStatement = SyncPreparedStatement;
|
|
103
|
-
}
|
|
104
|
-
type Async = AsyncDriver;
|
|
105
|
-
const Async: typeof AsyncDriver;
|
|
106
|
-
namespace Async {
|
|
107
|
-
type PreparedStatement = AsyncPreparedStatement;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
export {};
|
|
1
|
+
import { Cursor } from '../define/Cursor';
|
|
2
|
+
import { Expr } from '../define/Expr';
|
|
3
|
+
import { Query } from '../define/Query';
|
|
4
|
+
import { SchemaInstructions } from '../define/Schema';
|
|
5
|
+
import { Table } from '../define/Table';
|
|
6
|
+
import { Formatter } from './Formatter';
|
|
7
|
+
import { Statement } from './Statement';
|
|
8
|
+
declare class Callable extends Function {
|
|
9
|
+
constructor(fn: Function);
|
|
10
|
+
}
|
|
11
|
+
declare abstract class DriverBase extends Callable {
|
|
12
|
+
formatter: Formatter;
|
|
13
|
+
constructor(formatter: Formatter);
|
|
14
|
+
compile<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): [Query<T>, Statement];
|
|
15
|
+
all(...args: Array<any>): any;
|
|
16
|
+
get(...args: Array<any>): any;
|
|
17
|
+
sql(strings: TemplateStringsArray, ...params: Array<any>): Cursor<unknown>;
|
|
18
|
+
executeTemplate(expectedReturn: Query.RawReturn, strings: TemplateStringsArray, ...params: Array<any>): any;
|
|
19
|
+
abstract executeQuery(query: Query<any>): any;
|
|
20
|
+
}
|
|
21
|
+
type ParamTypes<Params extends [...any[]]> = {
|
|
22
|
+
[K in keyof Params]: Params[K] extends Expr<infer T> ? T : never;
|
|
23
|
+
} & {
|
|
24
|
+
length: Params['length'];
|
|
25
|
+
};
|
|
26
|
+
interface SyncDriver {
|
|
27
|
+
<T>(query: Cursor<T>): T;
|
|
28
|
+
<T>(...queries: Array<Cursor<any>>): T;
|
|
29
|
+
(strings: TemplateStringsArray, ...values: any[]): any;
|
|
30
|
+
}
|
|
31
|
+
declare abstract class SyncDriver extends DriverBase {
|
|
32
|
+
transactionId: number;
|
|
33
|
+
abstract prepareStatement(stmt: Statement, discardAfter: boolean): SyncPreparedStatement;
|
|
34
|
+
abstract schemaInstructions(tableName: string): SchemaInstructions | undefined;
|
|
35
|
+
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => R;
|
|
36
|
+
migrateSchema(...tables: Array<Table<any>>): unknown;
|
|
37
|
+
executeQuery<T>(query: Query<T>, stmt?: SyncPreparedStatement, params?: Array<any>): T;
|
|
38
|
+
all<T>(cursor: Cursor.SelectSingle<T>): Array<T>;
|
|
39
|
+
all<T>(cursor: Cursor<T>): T;
|
|
40
|
+
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Array<T>;
|
|
41
|
+
get<T>(cursor: Cursor.SelectMultiple<T>): T | null;
|
|
42
|
+
get<T>(cursor: Cursor<T>): T;
|
|
43
|
+
get<T>(strings: TemplateStringsArray, ...params: Array<any>): T;
|
|
44
|
+
iterate<T>(cursor: Cursor.SelectMultiple<T>): Iterable<T>;
|
|
45
|
+
transaction<T>(run: (query: SyncDriver) => T): T;
|
|
46
|
+
toAsync(): SyncWrapper;
|
|
47
|
+
}
|
|
48
|
+
interface SyncPreparedStatement {
|
|
49
|
+
run(params?: Array<any>): {
|
|
50
|
+
rowsAffected: number;
|
|
51
|
+
};
|
|
52
|
+
iterate<T>(params?: Array<any>): Iterable<T>;
|
|
53
|
+
all<T>(params?: Array<any>): Array<T>;
|
|
54
|
+
get<T>(params?: Array<any>): T;
|
|
55
|
+
execute(params?: Array<any>): void;
|
|
56
|
+
}
|
|
57
|
+
interface AsyncDriver {
|
|
58
|
+
<T>(query: Cursor<T>): Promise<T>;
|
|
59
|
+
<T>(...queries: Array<Cursor<any>>): Promise<T>;
|
|
60
|
+
(strings: TemplateStringsArray, ...values: any[]): Promise<any>;
|
|
61
|
+
}
|
|
62
|
+
declare abstract class AsyncDriver extends DriverBase {
|
|
63
|
+
transactionId: number;
|
|
64
|
+
abstract isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
65
|
+
abstract prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
66
|
+
abstract schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
67
|
+
prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => Promise<R>;
|
|
68
|
+
migrateSchema(...tables: Array<Table<any>>): Promise<unknown>;
|
|
69
|
+
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
70
|
+
all<T>(cursor: Cursor.SelectSingle<T>): Promise<Array<T>>;
|
|
71
|
+
all<T>(cursor: Cursor<T>): Promise<T>;
|
|
72
|
+
all<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<Array<T>>;
|
|
73
|
+
get<T>(cursor: Cursor.SelectMultiple<T>): Promise<T | null>;
|
|
74
|
+
get<T>(cursor: Cursor<T>): Promise<T>;
|
|
75
|
+
get<T>(strings: TemplateStringsArray, ...params: Array<any>): Promise<T>;
|
|
76
|
+
iterate<T>(cursor: Cursor.SelectMultiple<T>): AsyncIterable<T>;
|
|
77
|
+
transaction<T>(run: (query: AsyncDriver) => T): Promise<T>;
|
|
78
|
+
}
|
|
79
|
+
declare class SyncWrapper extends AsyncDriver {
|
|
80
|
+
private sync;
|
|
81
|
+
lock: Promise<void> | undefined;
|
|
82
|
+
constructor(sync: SyncDriver);
|
|
83
|
+
executeQuery<T>(query: Query<T>, stmt?: AsyncPreparedStatement, params?: Array<any>): Promise<T>;
|
|
84
|
+
prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
|
|
85
|
+
schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
|
|
86
|
+
isolate(): [connection: AsyncDriver, release: () => Promise<void>];
|
|
87
|
+
}
|
|
88
|
+
interface AsyncPreparedStatement {
|
|
89
|
+
run(params?: Array<any>): Promise<{
|
|
90
|
+
rowsAffected: number;
|
|
91
|
+
}>;
|
|
92
|
+
iterate<T>(params?: Array<any>): AsyncIterable<T>;
|
|
93
|
+
all<T>(params?: Array<any>): Promise<Array<T>>;
|
|
94
|
+
get<T>(params?: Array<any>): Promise<T>;
|
|
95
|
+
execute(params?: Array<any>): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export type Driver = SyncDriver | AsyncDriver;
|
|
98
|
+
export declare namespace Driver {
|
|
99
|
+
type Sync = SyncDriver;
|
|
100
|
+
const Sync: typeof SyncDriver;
|
|
101
|
+
namespace Sync {
|
|
102
|
+
type PreparedStatement = SyncPreparedStatement;
|
|
103
|
+
}
|
|
104
|
+
type Async = AsyncDriver;
|
|
105
|
+
const Async: typeof AsyncDriver;
|
|
106
|
+
namespace Async {
|
|
107
|
+
type PreparedStatement = AsyncPreparedStatement;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {};
|
package/dist/lib/Formatter.d.ts
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { ColumnData, ColumnType } from '../define/Column';
|
|
2
|
-
import { ExprData } from '../define/Expr';
|
|
3
|
-
import { OrderBy } from '../define/OrderBy';
|
|
4
|
-
import { Query } from '../define/Query';
|
|
5
|
-
import { Target } from '../define/Target';
|
|
6
|
-
import { Sanitizer } from './Sanitizer';
|
|
7
|
-
import { Statement, StatementOptions } from './Statement';
|
|
8
|
-
export interface FormatContext {
|
|
9
|
-
stmt: Statement;
|
|
10
|
-
nameResult?: string;
|
|
11
|
-
/** Skip prefixing fields with their table name */
|
|
12
|
-
skipTableName?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* In SQLite table names are used as expressions in the FTS5 plugin.
|
|
15
|
-
* To distinguish between formatting a row of the table and just the table name
|
|
16
|
-
* this flag can be used.
|
|
17
|
-
**/
|
|
18
|
-
tableAsExpr?: boolean;
|
|
19
|
-
/** Inline all parameters */
|
|
20
|
-
forceInline?: boolean;
|
|
21
|
-
formatAsJson?: boolean;
|
|
22
|
-
formatAsDefault?: boolean;
|
|
23
|
-
topLevel?: boolean;
|
|
24
|
-
}
|
|
25
|
-
type FormatSubject = (stmt: Statement, mkSubject: () => void) => void;
|
|
26
|
-
export declare abstract class Formatter implements Sanitizer {
|
|
27
|
-
constructor();
|
|
28
|
-
abstract escapeValue(value: any): string;
|
|
29
|
-
abstract escapeIdentifier(ident: string): string;
|
|
30
|
-
abstract formatParamValue(paramValue: any): any;
|
|
31
|
-
abstract formatAccess(ctx: FormatContext, mkSubject: () => void, field: string): Statement;
|
|
32
|
-
compile<T>(query: Query<T>, options?: Partial<FormatContext>): Statement;
|
|
33
|
-
createContext(options?: Partial<FormatContext> & StatementOptions): {
|
|
34
|
-
stmt: Statement;
|
|
35
|
-
nameResult?: string | undefined;
|
|
36
|
-
skipTableName?: boolean | undefined;
|
|
37
|
-
tableAsExpr?: boolean | undefined;
|
|
38
|
-
forceInline?: boolean | undefined;
|
|
39
|
-
formatAsJson?: boolean | undefined;
|
|
40
|
-
formatAsDefault?: boolean | undefined;
|
|
41
|
-
topLevel?: boolean | undefined;
|
|
42
|
-
skipNewlines?: boolean | undefined;
|
|
43
|
-
};
|
|
44
|
-
format<T>(ctx: FormatContext, query: Query<T>): Statement;
|
|
45
|
-
formatSelect(ctx: FormatContext, query: Query.Select): Statement;
|
|
46
|
-
formatInsert(ctx: FormatContext, query: Query.Insert): Statement;
|
|
47
|
-
formatUpdate(ctx: FormatContext, query: Query.Update): Statement;
|
|
48
|
-
formatDelete(ctx: FormatContext, query: Query.Delete): Statement;
|
|
49
|
-
formatCreateTable(ctx: FormatContext, query: Query.CreateTable): Statement;
|
|
50
|
-
formatCreateIndex(ctx: FormatContext, query: Query.CreateIndex): Statement;
|
|
51
|
-
formatDropIndex(ctx: FormatContext, query: Query.DropIndex): Statement;
|
|
52
|
-
formatAlterTable(ctx: FormatContext, query: Query.AlterTable): Statement;
|
|
53
|
-
formatTransaction(ctx: FormatContext, { op, id }: Query.Transaction): Statement;
|
|
54
|
-
formatBatch(ctx: FormatContext, { queries }: Query.Batch): Statement;
|
|
55
|
-
formatRaw(ctx: FormatContext, { strings, params }: Query.Raw): Statement;
|
|
56
|
-
formatColumn(ctx: FormatContext, column: ColumnData): Statement;
|
|
57
|
-
formatContraintReference(ctx: FormatContext, reference: ExprData): Statement;
|
|
58
|
-
formatType(ctx: FormatContext, type: ColumnType): Statement;
|
|
59
|
-
formatInsertRow(ctx: FormatContext, columns: Record<string, ColumnData>, row: Record<string, any>): Statement;
|
|
60
|
-
formatColumnValue(ctx: FormatContext, column: ColumnData, columnValue: any): Statement;
|
|
61
|
-
formatTarget(ctx: FormatContext, target: Target): Statement;
|
|
62
|
-
formatWhere(ctx: FormatContext, expr: ExprData | undefined): Statement;
|
|
63
|
-
formatHaving(ctx: FormatContext, expr: ExprData | undefined): Statement;
|
|
64
|
-
formatGroupBy(ctx: FormatContext, groupBy: Array<ExprData> | undefined): Statement;
|
|
65
|
-
formatOrderBy(ctx: FormatContext, orderBy: Array<OrderBy> | undefined): Statement;
|
|
66
|
-
formatLimit(ctx: FormatContext, { limit, offset, singleResult }: Query.QueryBase): Statement;
|
|
67
|
-
formatSelection(ctx: FormatContext, selection: ExprData, formatSubject?: FormatSubject): Statement;
|
|
68
|
-
formatExprJson(ctx: FormatContext, expr: ExprData): Statement;
|
|
69
|
-
formatExprValue(ctx: FormatContext, expr: ExprData): Statement;
|
|
70
|
-
formatIn(ctx: FormatContext, expr: ExprData): Statement;
|
|
71
|
-
retrieveField(expr: ExprData, field: string): ExprData | undefined;
|
|
72
|
-
formatField(ctx: FormatContext, expr: ExprData, field: string): Statement;
|
|
73
|
-
formatString(ctx: FormatContext, input: string): Statement;
|
|
74
|
-
formatInlineValue(ctx: FormatContext, rawValue: any): Statement;
|
|
75
|
-
formatValue(ctx: FormatContext, rawValue: any): Statement;
|
|
76
|
-
formatExpr(ctx: FormatContext, expr: ExprData): Statement;
|
|
77
|
-
}
|
|
78
|
-
export {};
|
|
1
|
+
import { ColumnData, ColumnType } from '../define/Column';
|
|
2
|
+
import { ExprData } from '../define/Expr';
|
|
3
|
+
import { OrderBy } from '../define/OrderBy';
|
|
4
|
+
import { Query } from '../define/Query';
|
|
5
|
+
import { Target } from '../define/Target';
|
|
6
|
+
import { Sanitizer } from './Sanitizer';
|
|
7
|
+
import { Statement, StatementOptions } from './Statement';
|
|
8
|
+
export interface FormatContext {
|
|
9
|
+
stmt: Statement;
|
|
10
|
+
nameResult?: string;
|
|
11
|
+
/** Skip prefixing fields with their table name */
|
|
12
|
+
skipTableName?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* In SQLite table names are used as expressions in the FTS5 plugin.
|
|
15
|
+
* To distinguish between formatting a row of the table and just the table name
|
|
16
|
+
* this flag can be used.
|
|
17
|
+
**/
|
|
18
|
+
tableAsExpr?: boolean;
|
|
19
|
+
/** Inline all parameters */
|
|
20
|
+
forceInline?: boolean;
|
|
21
|
+
formatAsJson?: boolean;
|
|
22
|
+
formatAsDefault?: boolean;
|
|
23
|
+
topLevel?: boolean;
|
|
24
|
+
}
|
|
25
|
+
type FormatSubject = (stmt: Statement, mkSubject: () => void) => void;
|
|
26
|
+
export declare abstract class Formatter implements Sanitizer {
|
|
27
|
+
constructor();
|
|
28
|
+
abstract escapeValue(value: any): string;
|
|
29
|
+
abstract escapeIdentifier(ident: string): string;
|
|
30
|
+
abstract formatParamValue(paramValue: any): any;
|
|
31
|
+
abstract formatAccess(ctx: FormatContext, mkSubject: () => void, field: string): Statement;
|
|
32
|
+
compile<T>(query: Query<T>, options?: Partial<FormatContext>): Statement;
|
|
33
|
+
createContext(options?: Partial<FormatContext> & StatementOptions): {
|
|
34
|
+
stmt: Statement;
|
|
35
|
+
nameResult?: string | undefined;
|
|
36
|
+
skipTableName?: boolean | undefined;
|
|
37
|
+
tableAsExpr?: boolean | undefined;
|
|
38
|
+
forceInline?: boolean | undefined;
|
|
39
|
+
formatAsJson?: boolean | undefined;
|
|
40
|
+
formatAsDefault?: boolean | undefined;
|
|
41
|
+
topLevel?: boolean | undefined;
|
|
42
|
+
skipNewlines?: boolean | undefined;
|
|
43
|
+
};
|
|
44
|
+
format<T>(ctx: FormatContext, query: Query<T>): Statement;
|
|
45
|
+
formatSelect(ctx: FormatContext, query: Query.Select): Statement;
|
|
46
|
+
formatInsert(ctx: FormatContext, query: Query.Insert): Statement;
|
|
47
|
+
formatUpdate(ctx: FormatContext, query: Query.Update): Statement;
|
|
48
|
+
formatDelete(ctx: FormatContext, query: Query.Delete): Statement;
|
|
49
|
+
formatCreateTable(ctx: FormatContext, query: Query.CreateTable): Statement;
|
|
50
|
+
formatCreateIndex(ctx: FormatContext, query: Query.CreateIndex): Statement;
|
|
51
|
+
formatDropIndex(ctx: FormatContext, query: Query.DropIndex): Statement;
|
|
52
|
+
formatAlterTable(ctx: FormatContext, query: Query.AlterTable): Statement;
|
|
53
|
+
formatTransaction(ctx: FormatContext, { op, id }: Query.Transaction): Statement;
|
|
54
|
+
formatBatch(ctx: FormatContext, { queries }: Query.Batch): Statement;
|
|
55
|
+
formatRaw(ctx: FormatContext, { strings, params }: Query.Raw): Statement;
|
|
56
|
+
formatColumn(ctx: FormatContext, column: ColumnData): Statement;
|
|
57
|
+
formatContraintReference(ctx: FormatContext, reference: ExprData): Statement;
|
|
58
|
+
formatType(ctx: FormatContext, type: ColumnType): Statement;
|
|
59
|
+
formatInsertRow(ctx: FormatContext, columns: Record<string, ColumnData>, row: Record<string, any>): Statement;
|
|
60
|
+
formatColumnValue(ctx: FormatContext, column: ColumnData, columnValue: any): Statement;
|
|
61
|
+
formatTarget(ctx: FormatContext, target: Target): Statement;
|
|
62
|
+
formatWhere(ctx: FormatContext, expr: ExprData | undefined): Statement;
|
|
63
|
+
formatHaving(ctx: FormatContext, expr: ExprData | undefined): Statement;
|
|
64
|
+
formatGroupBy(ctx: FormatContext, groupBy: Array<ExprData> | undefined): Statement;
|
|
65
|
+
formatOrderBy(ctx: FormatContext, orderBy: Array<OrderBy> | undefined): Statement;
|
|
66
|
+
formatLimit(ctx: FormatContext, { limit, offset, singleResult }: Query.QueryBase): Statement;
|
|
67
|
+
formatSelection(ctx: FormatContext, selection: ExprData, formatSubject?: FormatSubject): Statement;
|
|
68
|
+
formatExprJson(ctx: FormatContext, expr: ExprData): Statement;
|
|
69
|
+
formatExprValue(ctx: FormatContext, expr: ExprData): Statement;
|
|
70
|
+
formatIn(ctx: FormatContext, expr: ExprData): Statement;
|
|
71
|
+
retrieveField(expr: ExprData, field: string): ExprData | undefined;
|
|
72
|
+
formatField(ctx: FormatContext, expr: ExprData, field: string): Statement;
|
|
73
|
+
formatString(ctx: FormatContext, input: string): Statement;
|
|
74
|
+
formatInlineValue(ctx: FormatContext, rawValue: any): Statement;
|
|
75
|
+
formatValue(ctx: FormatContext, rawValue: any): Statement;
|
|
76
|
+
formatExpr(ctx: FormatContext, expr: ExprData): Statement;
|
|
77
|
+
}
|
|
78
|
+
export {};
|
package/dist/lib/Sanitizer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export interface Sanitizer {
|
|
2
|
-
escapeValue(value: any): string;
|
|
3
|
-
escapeIdentifier(ident: string): string;
|
|
4
|
-
formatParamValue(paramValue: any): any;
|
|
5
|
-
}
|
|
1
|
+
export interface Sanitizer {
|
|
2
|
+
escapeValue(value: any): string;
|
|
3
|
+
escapeIdentifier(ident: string): string;
|
|
4
|
+
formatParamValue(paramValue: any): any;
|
|
5
|
+
}
|
package/dist/lib/SqlError.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class SqlError extends Error {
|
|
2
|
-
constructor(cause: Error, sql: string);
|
|
3
|
-
}
|
|
1
|
+
export declare class SqlError extends Error {
|
|
2
|
+
constructor(cause: Error, sql: string);
|
|
3
|
+
}
|
package/dist/lib/Statement.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { ParamData } from '../define/Param';
|
|
2
|
-
import { Sanitizer } from './Sanitizer';
|
|
3
|
-
export interface StatementOptions {
|
|
4
|
-
skipNewlines?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare class Statement {
|
|
7
|
-
sanitizer: Sanitizer;
|
|
8
|
-
options: StatementOptions;
|
|
9
|
-
sql: string;
|
|
10
|
-
paramData: Array<ParamData>;
|
|
11
|
-
currentIndent: string;
|
|
12
|
-
constructor(sanitizer: Sanitizer, options?: StatementOptions);
|
|
13
|
-
space(): this;
|
|
14
|
-
add(addition: undefined | string): this;
|
|
15
|
-
addLine(addition: undefined | string): this;
|
|
16
|
-
indent(): this;
|
|
17
|
-
dedent(): this;
|
|
18
|
-
newline(): this;
|
|
19
|
-
identifier(name: string): this;
|
|
20
|
-
addIdentifier(name: string): this;
|
|
21
|
-
value(value: any): this;
|
|
22
|
-
addValue(value: any): this;
|
|
23
|
-
param(data: ParamData): this;
|
|
24
|
-
addParam(data: ParamData): this;
|
|
25
|
-
raw(query: string): this;
|
|
26
|
-
openParenthesis(): this;
|
|
27
|
-
closeParenthesis(): this;
|
|
28
|
-
call<T>(parts: Array<T>, separator?: string): Generator<T, this | undefined, unknown>;
|
|
29
|
-
separate<T>(parts: Array<T>, separator?: string): Generator<T, void, unknown>;
|
|
30
|
-
isEmpty(): boolean;
|
|
31
|
-
params(input?: Record<string, any>): Array<any>;
|
|
32
|
-
toString(): string;
|
|
33
|
-
}
|
|
1
|
+
import { ParamData } from '../define/Param';
|
|
2
|
+
import { Sanitizer } from './Sanitizer';
|
|
3
|
+
export interface StatementOptions {
|
|
4
|
+
skipNewlines?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class Statement {
|
|
7
|
+
sanitizer: Sanitizer;
|
|
8
|
+
options: StatementOptions;
|
|
9
|
+
sql: string;
|
|
10
|
+
paramData: Array<ParamData>;
|
|
11
|
+
currentIndent: string;
|
|
12
|
+
constructor(sanitizer: Sanitizer, options?: StatementOptions);
|
|
13
|
+
space(): this;
|
|
14
|
+
add(addition: undefined | string): this;
|
|
15
|
+
addLine(addition: undefined | string): this;
|
|
16
|
+
indent(): this;
|
|
17
|
+
dedent(): this;
|
|
18
|
+
newline(): this;
|
|
19
|
+
identifier(name: string): this;
|
|
20
|
+
addIdentifier(name: string): this;
|
|
21
|
+
value(value: any): this;
|
|
22
|
+
addValue(value: any): this;
|
|
23
|
+
param(data: ParamData): this;
|
|
24
|
+
addParam(data: ParamData): this;
|
|
25
|
+
raw(query: string): this;
|
|
26
|
+
openParenthesis(): this;
|
|
27
|
+
closeParenthesis(): this;
|
|
28
|
+
call<T>(parts: Array<T>, separator?: string): Generator<T, this | undefined, unknown>;
|
|
29
|
+
separate<T>(parts: Array<T>, separator?: string): Generator<T, void, unknown>;
|
|
30
|
+
isEmpty(): boolean;
|
|
31
|
+
params(input?: Record<string, any>): Array<any>;
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ExprData } from '../define/Expr';
|
|
2
|
-
import { FormatContext, Formatter } from '../lib/Formatter';
|
|
3
|
-
import { Statement } from '../lib/Statement';
|
|
4
|
-
export declare class SqliteFormatter extends Formatter {
|
|
5
|
-
formatParamValue(paramValue: any): any;
|
|
6
|
-
escapeValue(value: any): string;
|
|
7
|
-
escapeIdentifier(input: string): string;
|
|
8
|
-
escapeString(input: string): string;
|
|
9
|
-
formatAccess(ctx: FormatContext, mkSubject: () => void, field: string): Statement;
|
|
10
|
-
formatExpr(ctx: FormatContext, expr: ExprData): Statement;
|
|
11
|
-
}
|
|
1
|
+
import { ExprData } from '../define/Expr';
|
|
2
|
+
import { FormatContext, Formatter } from '../lib/Formatter';
|
|
3
|
+
import { Statement } from '../lib/Statement';
|
|
4
|
+
export declare class SqliteFormatter extends Formatter {
|
|
5
|
+
formatParamValue(paramValue: any): any;
|
|
6
|
+
escapeValue(value: any): string;
|
|
7
|
+
escapeIdentifier(input: string): string;
|
|
8
|
+
escapeString(input: string): string;
|
|
9
|
+
formatAccess(ctx: FormatContext, mkSubject: () => void, field: string): Statement;
|
|
10
|
+
formatExpr(ctx: FormatContext, expr: ExprData): Statement;
|
|
11
|
+
}
|