-
Notifications
You must be signed in to change notification settings - Fork 279
/
drop-index-node.ts
41 lines (36 loc) · 1 KB
/
drop-index-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
35
36
37
38
39
40
41
import { freeze } from '../util/object-utils.js'
import { IdentifierNode } from './identifier-node.js'
import { OperationNode } from './operation-node.js'
import { TableNode } from './table-node.js'
export type DropIndexNodeProps = Omit<DropIndexNode, 'kind' | 'name'>
export type DropIndexNodeModifier = 'IfExists'
export interface DropIndexNode extends OperationNode {
readonly kind: 'DropIndexNode'
readonly name: IdentifierNode
readonly table?: TableNode
readonly modifier?: DropIndexNodeModifier
}
/**
* @internal
*/
export const DropIndexNode = freeze({
is(node: OperationNode): node is DropIndexNode {
return node.kind === 'DropIndexNode'
},
create(name: string, params?: DropIndexNodeProps): DropIndexNode {
return freeze({
kind: 'DropIndexNode',
name: IdentifierNode.create(name),
...params,
})
},
cloneWith(
dropIndex: DropIndexNode,
props: DropIndexNodeProps
): DropIndexNode {
return freeze({
...dropIndex,
...props,
})
},
})