-
Notifications
You must be signed in to change notification settings - Fork 280
/
having-interface.ts
80 lines (70 loc) · 2.7 KB
/
having-interface.ts
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
import { Expression } from '../expression/expression.js'
import {
ComparisonOperatorExpression,
HavingGrouper,
OperandValueExpressionOrList,
} from '../parser/binary-operation-parser.js'
import { ReferenceExpression } from '../parser/reference-parser.js'
import { ExistsExpression } from '../parser/unary-operation-parser.js'
export interface HavingInterface<DB, TB extends keyof DB> {
/**
* Just like {@link WhereInterface.where | where} but adds a `having` statement
* instead of a `where` statement.
*/
having<RE extends ReferenceExpression<DB, TB>>(
lhs: RE,
op: ComparisonOperatorExpression,
rhs: OperandValueExpressionOrList<DB, TB, RE>
): HavingInterface<DB, TB>
having(grouper: HavingGrouper<DB, TB>): HavingInterface<DB, TB>
having(expression: Expression<any>): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.whereRef | whereRef} but adds a `having` statement
* instead of a `where` statement.
*/
havingRef(
lhs: ReferenceExpression<DB, TB>,
op: ComparisonOperatorExpression,
rhs: ReferenceExpression<DB, TB>
): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.orWhere | orWhere} but adds a `having` statement
* instead of a `where` statement.
*/
orHaving<RE extends ReferenceExpression<DB, TB>>(
lhs: RE,
op: ComparisonOperatorExpression,
rhs: OperandValueExpressionOrList<DB, TB, RE>
): HavingInterface<DB, TB>
orHaving(grouper: HavingGrouper<DB, TB>): HavingInterface<DB, TB>
orHaving(expression: Expression<any>): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.orWhereRef | orWhereRef} but adds a `having` statement
* instead of a `where` statement.
*/
orHavingRef(
lhs: ReferenceExpression<DB, TB>,
op: ComparisonOperatorExpression,
rhs: ReferenceExpression<DB, TB>
): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.whereExists | whereExists} but adds a `having` statement
* instead of a `where` statement.
*/
havingExists(arg: ExistsExpression<DB, TB>): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.whereNotExists | whereNotExists} but adds a `having` statement
* instead of a `where` statement.
*/
havingNotExist(arg: ExistsExpression<DB, TB>): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.orWhereExists | orWhereExists} but adds a `having` statement
* instead of a `where` statement.
*/
orHavingExists(arg: ExistsExpression<DB, TB>): HavingInterface<DB, TB>
/**
* Just like {@link WhereInterface.orWhereNotExists | orWhereNotExists} but adds a `having` statement
* instead of a `where` statement.
*/
orHavingNotExists(arg: ExistsExpression<DB, TB>): HavingInterface<DB, TB>
}