@@ -5,7 +5,6 @@ import type {
5
5
SqlClientPool ,
6
6
SqlConnectionOptions ,
7
7
SqlPoolClient ,
8
- SqlPoolClientOptions ,
9
8
SqlPreparable ,
10
9
SqlPreparedStatement ,
11
10
SqlQueriable ,
@@ -15,28 +14,26 @@ import type {
15
14
SqlTransactionOptions
16
15
} from '@stdext/sql' ;
17
16
18
- import type { DatabaseOpenOptions } from './database.js' ;
19
17
import {
20
- SqliteCloseEvent ,
21
- SqliteConnectEvent ,
22
- SqliteEvents ,
23
- SqliteEventTarget
24
- } from './events.js ' ;
18
+ ReservedConnection ,
19
+ SqliteDriverConnectionPool ,
20
+ SqliteDriverStatement ,
21
+ SqliteValue
22
+ } from '@sqlite-js/driver ' ;
25
23
import {
26
24
SqliteConnectable ,
27
25
SqliteConnection ,
28
26
SqliteReservedConnection ,
29
27
type SqliteConnectionOptions
30
28
} from './connection.js' ;
29
+ import type { DatabaseOpenOptions } from './database.js' ;
31
30
import { SqliteTransactionError } from './errors.js' ;
32
- import { mergeQueryOptions , transformToAsyncGenerator } from './util.js' ;
33
31
import {
34
- ReservedConnection ,
35
- SqliteDriverConnection ,
36
- SqliteDriverConnectionPool ,
37
- SqliteDriverStatement ,
38
- SqliteValue
39
- } from '@sqlite-js/driver' ;
32
+ SqliteCloseEvent ,
33
+ SqliteConnectEvent ,
34
+ SqliteEventTarget
35
+ } from './events.js' ;
36
+ import { mergeQueryOptions } from './util.js' ;
40
37
41
38
export type SqliteParameterType = SqliteValue ;
42
39
export type BindValue = SqliteValue ;
@@ -60,13 +57,7 @@ export interface SqliteClientOptions
60
57
61
58
export class SqlitePreparedStatement
62
59
extends SqliteConnectable
63
- implements
64
- SqlPreparedStatement <
65
- SqliteConnectionOptions ,
66
- SqliteParameterType ,
67
- SqliteQueryOptions ,
68
- SqliteConnection
69
- >
60
+ implements SqlPreparedStatement
70
61
{
71
62
readonly sql : string ;
72
63
declare readonly options : SqliteConnectionOptions & SqliteQueryOptions ;
@@ -221,16 +212,7 @@ export class SqlitePreparedStatement
221
212
/**
222
213
* Represents a base queriable class for SQLite3.
223
214
*/
224
- export class SqliteQueriable
225
- extends SqliteConnectable
226
- implements
227
- SqlQueriable <
228
- SqliteConnectionOptions ,
229
- SqliteParameterType ,
230
- SqliteQueryOptions ,
231
- SqliteConnection
232
- >
233
- {
215
+ export class SqliteQueriable extends SqliteConnectable implements SqlQueriable {
234
216
declare readonly options : SqliteConnectionOptions & SqliteQueryOptions ;
235
217
236
218
constructor (
@@ -323,26 +305,11 @@ export class SqliteQueriable
323
305
324
306
export class SqlitePreparable
325
307
extends SqliteQueriable
326
- implements
327
- SqlPreparable <
328
- SqliteConnectionOptions ,
329
- SqliteParameterType ,
330
- SqliteQueryOptions ,
331
- SqliteConnection ,
332
- SqlitePreparedStatement
333
- > { }
308
+ implements SqlPreparable { }
334
309
335
310
export class SqliteTransaction
336
311
extends SqliteQueriable
337
- implements
338
- SqlTransaction <
339
- SqliteConnectionOptions ,
340
- SqliteParameterType ,
341
- SqliteQueryOptions ,
342
- SqliteConnection ,
343
- SqlitePreparedStatement ,
344
- SqliteTransactionOptions
345
- >
312
+ implements SqlTransaction
346
313
{
347
314
#inTransaction: boolean = true ;
348
315
get inTransaction ( ) : boolean {
@@ -399,16 +366,7 @@ export class SqliteTransaction
399
366
*/
400
367
export class SqliteTransactionable
401
368
extends SqlitePreparable
402
- implements
403
- SqlTransactionable <
404
- SqliteConnectionOptions ,
405
- SqliteParameterType ,
406
- SqliteQueryOptions ,
407
- SqliteConnection ,
408
- SqlitePreparedStatement ,
409
- SqliteTransactionOptions ,
410
- SqliteTransaction
411
- >
369
+ implements SqlTransactionable
412
370
{
413
371
async beginTransaction (
414
372
options ?: SqliteTransactionOptions [ 'beginTransactionOptions' ]
@@ -446,20 +404,7 @@ export class SqliteTransactionable
446
404
/**
447
405
* Single-connection client. Not safe to use concurrently.
448
406
*/
449
- export class SqliteClient
450
- extends SqliteTransactionable
451
- implements
452
- SqlClient <
453
- SqliteEventTarget ,
454
- SqliteConnectionOptions ,
455
- SqliteParameterType ,
456
- SqliteQueryOptions ,
457
- SqliteConnection ,
458
- SqlitePreparedStatement ,
459
- SqliteTransactionOptions ,
460
- SqliteTransaction
461
- >
462
- {
407
+ export class SqliteClient extends SqliteTransactionable implements SqlClient {
463
408
readonly eventTarget : SqliteEventTarget ;
464
409
465
410
constructor (
@@ -554,18 +499,7 @@ class SqlitePoolClient
554
499
/**
555
500
* Sqlite client
556
501
*/
557
- export class SqliteClientPool
558
- implements
559
- SqlClientPool <
560
- SqliteConnectionOptions ,
561
- SqliteParameterType ,
562
- SqliteQueryOptions ,
563
- SqliteConnection ,
564
- SqlitePreparedStatement ,
565
- SqliteTransactionOptions ,
566
- SqliteTransaction
567
- >
568
- {
502
+ export class SqliteClientPool implements SqlClientPool {
569
503
readonly eventTarget : SqliteEventTarget ;
570
504
571
505
readonly connectionUrl : string ;
@@ -584,18 +518,7 @@ export class SqliteClientPool
584
518
this . eventTarget = new SqliteEventTarget ( ) ;
585
519
}
586
520
587
- async acquire ( ) : Promise <
588
- SqlPoolClient <
589
- SqliteConnectionOptions ,
590
- SqliteConnection ,
591
- SqliteValue ,
592
- SqliteQueryOptions ,
593
- SqlitePreparedStatement ,
594
- SqliteTransactionOptions ,
595
- SqliteTransaction ,
596
- SqlPoolClientOptions
597
- >
598
- > {
521
+ async acquire ( ) : Promise < SqlPoolClient > {
599
522
const reserved = await this . pool . reserveConnection ( ) ;
600
523
return new SqlitePoolClient ( this . connectionUrl , reserved , this . options ) ;
601
524
}
0 commit comments