-
Notifications
You must be signed in to change notification settings - Fork 290
/
Copy pathalias-node.ts
38 lines (34 loc) · 971 Bytes
/
alias-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
import { freeze } from '../util/object-utils.js'
import { ColumnNode } from './column-node.js'
import { IdentifierNode } from './identifier-node.js'
import { OperationNode } from './operation-node.js'
import { RawNode } from './raw-node.js'
import { ReferenceNode } from './reference-node.js'
import { SelectQueryNode } from './select-query-node.js'
import { TableNode } from './table-node.js'
export type AliasNodeChild =
| ColumnNode
| ReferenceNode
| TableNode
| RawNode
| SelectQueryNode
export interface AliasNode extends OperationNode {
readonly kind: 'AliasNode'
readonly node: AliasNodeChild
readonly alias: IdentifierNode
}
/**
* @internal
*/
export const AliasNode = freeze({
is(node: OperationNode): node is AliasNode {
return node.kind === 'AliasNode'
},
create(node: AliasNodeChild, alias: string): AliasNode {
return freeze({
kind: 'AliasNode',
node,
alias: IdentifierNode.create(alias),
})
},
})