@@ -180,10 +180,18 @@ export class SqliteBuilder<DB extends Record<string, any>> {
180
180
* execute and return result list,
181
181
* auto detect transaction, auto catch error
182
182
*/
183
+ public async execute < O > (
184
+ query : CompiledQuery < O > ,
185
+ ) : Promise < QueryResult < O > >
183
186
public async execute < O > (
184
187
fn : ( db : Kysely < DB > | Transaction < DB > ) => AvailableBuilder < DB , O > ,
185
- ) : Promise < Simplify < O > [ ] | undefined > {
186
- return await fn ( this . getDB ( ) ) . execute ( )
188
+ ) : Promise < Simplify < O > [ ] | undefined >
189
+ public async execute < O > (
190
+ data : CompiledQuery < O > | ( ( db : Kysely < DB > | Transaction < DB > ) => AvailableBuilder < DB , O > ) ,
191
+ ) : Promise < QueryResult < O > | Simplify < O > [ ] | undefined > {
192
+ return typeof data === 'function'
193
+ ? await data ( this . getDB ( ) ) . execute ( )
194
+ : await this . getDB ( ) . executeQuery ( data )
187
195
}
188
196
189
197
/**
@@ -214,26 +222,6 @@ export class SqliteBuilder<DB extends Record<string, any>> {
214
222
return precompileQuery ( queryBuilder ( this . kysely ) , this . serializer )
215
223
}
216
224
217
- /**
218
- * exec compiled query, return result,
219
- * auto detect transaction, auto catch error
220
- */
221
- public async executeCompiled < O > (
222
- query : CompiledQuery < O > ,
223
- ) : Promise < QueryResult < O > > {
224
- return await this . getDB ( ) . executeQuery ( query )
225
- }
226
-
227
- /**
228
- * run {@link execCompiled} and get its rows,
229
- * auto detect transaction, auto catch error
230
- */
231
- public async executeCompiledTakeList < O > (
232
- query : CompiledQuery < O > ,
233
- ) : Promise < O [ ] > {
234
- return ( await this . executeCompiled ( query ) ) . rows
235
- }
236
-
237
225
/**
238
226
* execute raw sql,
239
227
* auto detect transaction, auto catch error
0 commit comments