-
Notifications
You must be signed in to change notification settings - Fork 280
/
drop-schema-node.ts
42 lines (37 loc) · 1014 Bytes
/
drop-schema-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
42
import { freeze } from '../util/object-utils.js'
import { IdentifierNode } from './identifier-node.js'
import { OperationNode } from './operation-node.js'
export type DropSchemaNodeModifier = 'IfExists'
export type DropSchemaNodeParams = Omit<
Partial<DropSchemaNode>,
'kind' | 'schema'
>
export interface DropSchemaNode extends OperationNode {
readonly kind: 'DropSchemaNode'
readonly schema: IdentifierNode
readonly modifier?: DropSchemaNodeModifier
}
/**
* @internal
*/
export const DropSchemaNode = freeze({
is(node: OperationNode): node is DropSchemaNode {
return node.kind === 'DropSchemaNode'
},
create(schema: string, params?: DropSchemaNodeParams): DropSchemaNode {
return freeze({
kind: 'DropSchemaNode',
schema: IdentifierNode.create(schema),
...params,
})
},
cloneWithModifier(
createSchema: DropSchemaNode,
modifier: DropSchemaNodeModifier
): DropSchemaNode {
return freeze({
...createSchema,
modifier,
})
},
})