-
Notifications
You must be signed in to change notification settings - Fork 280
/
delete-query-node.ts
34 lines (31 loc) · 1.01 KB
/
delete-query-node.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
import { freeze } from '../util/object-utils.js'
import { FromNode } from './from-node.js'
import { JoinNode } from './join-node.js'
import { OperationNode } from './operation-node.js'
import { TableExpressionNode } from './operation-node-utils.js'
import { ReturningNode } from './returning-node.js'
import { WhereNode } from './where-node.js'
import { WithNode } from './with-node.js'
export interface DeleteQueryNode extends OperationNode {
readonly kind: 'DeleteQueryNode'
readonly from: FromNode
readonly joins?: ReadonlyArray<JoinNode>
readonly where?: WhereNode
readonly returning?: ReturningNode
readonly with?: WithNode
}
/**
* @internal
*/
export const DeleteQueryNode = freeze({
is(node: OperationNode): node is DeleteQueryNode {
return node.kind === 'DeleteQueryNode'
},
create(fromItem: TableExpressionNode, withNode?: WithNode): DeleteQueryNode {
return freeze({
kind: 'DeleteQueryNode',
from: FromNode.create([fromItem]),
...(withNode && { with: withNode }),
})
},
})