Skip to content

Commit 0158214

Browse files
committed
??
1 parent 2842bf5 commit 0158214

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/query-builder/select-query-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ import { OrderByInterface } from './order-by-interface.js'
8585
import { Executable, ExecuteOptions } from '../util/executable.js'
8686

8787
export interface SelectQueryBuilder<DB, TB extends keyof DB, O>
88-
extends Executable<Simplify<O>>,
89-
WhereInterface<DB, TB>,
88+
extends WhereInterface<DB, TB>,
9089
HavingInterface<DB, TB>,
9190
OrderByInterface<DB, TB, O>,
9291
SelectQueryBuilderExpression<O>,
9392
Compilable<O>,
93+
Executable<O>,
9494
Explainable,
9595
Streamable<O> {
9696
where<

src/util/executable.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import { QueryNode } from '../operation-node/query-node.js'
22
import { NoResultErrorConstructor } from '../query-builder/no-result-error.js'
33
import { ExecuteQueryOptions } from '../query-executor/query-executor.js'
4+
import { Simplify, SimplifySingleResult } from './type-utils.js'
45

56
export interface Executable<O> {
67
/**
78
* Executes the query and returns an array of rows.
89
*
910
* Also see the {@link executeTakeFirst} and {@link executeTakeFirstOrThrow} methods.
1011
*/
11-
execute(options?: ExecuteOptions): Promise<O[]>
12+
execute(options?: ExecuteOptions): Promise<SimplifySingleResult<O>[]>
1213

1314
/**
1415
* Executes the query and returns the first result or undefined if
1516
* the query returned no result.
1617
*/
17-
executeTakeFirst(options?: ExecuteOptions): Promise<O | undefined>
18+
executeTakeFirst(
19+
options?: ExecuteOptions,
20+
): Promise<SimplifySingleResult<O> | undefined>
1821

1922
/**
2023
* Executes the query and returns the first result or throws if
@@ -26,13 +29,13 @@ export interface Executable<O> {
2629
*/
2730
executeTakeFirstOrThrow(
2831
errorConstructor?: NoResultErrorConstructor | ((node: QueryNode) => Error),
29-
): Promise<O>
32+
): Promise<SimplifySingleResult<O>>
3033

3134
executeTakeFirstOrThrow(
3235
options?: ExecuteOptions & {
3336
errorConstructor?: NoResultErrorConstructor | ((node: QueryNode) => Error)
3437
},
35-
): Promise<O>
38+
): Promise<SimplifySingleResult<O>>
3639
}
3740

3841
export interface ExecuteOptions extends ExecuteQueryOptions {}

0 commit comments

Comments
 (0)