Skip to content

Commit

Permalink
Add first version of union and unionAll methods
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Nov 24, 2021
1 parent 55f546f commit 57589b3
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 426 deletions.
11 changes: 11 additions & 0 deletions src/operation-node/operation-node-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { ForeignKeyConstraintNode } from './foreign-key-constraint-node.js'
import { ColumnDefinitionNode } from './column-definition-node.js'
import { ModifyColumnNode } from './modify-column-node.js'
import { OnDuplicateKeyNode } from './on-duplicate-key-node.js'
import { UnionNode } from './union-node.js'

/**
* Transforms an operation node tree into another one.
Expand Down Expand Up @@ -150,6 +151,7 @@ export class OperationNodeTransformer {
AddConstraintNode: this.transformAddConstraint.bind(this),
DropConstraintNode: this.transformDropConstraint.bind(this),
ForeignKeyConstraintNode: this.transformForeignKeyConstraint.bind(this),
UnionNode: this.transformUnion.bind(this),
}

readonly transformNode = <T extends OperationNode | undefined>(
Expand Down Expand Up @@ -192,6 +194,7 @@ export class OperationNodeTransformer {
offset: this.transformNode(node.offset),
with: this.transformNode(node.with),
having: this.transformNode(node.having),
union: this.transformNodeList(node.union),
}
}

Expand Down Expand Up @@ -519,6 +522,14 @@ export class OperationNodeTransformer {
}
}

protected transformUnion(node: UnionNode): UnionNode {
return {
kind: 'UnionNode',
union: this.transformNode(node.union),
all: node.all,
}
}

protected transformReferences(node: ReferencesNode): ReferencesNode {
return {
kind: 'ReferencesNode',
Expand Down
Loading

0 comments on commit 57589b3

Please sign in to comment.