Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MERGE query support. #700

Merged
merged 66 commits into from
Jan 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
42f457e
add merge query node.
igalklebanov Sep 16, 2023
1c60272
add merge query to visitor.
igalklebanov Sep 16, 2023
6a7f54a
add merge query to transformer.
igalklebanov Sep 16, 2023
0dca364
Merge branch 'master' into merge
igalklebanov Sep 22, 2023
4f3c604
add using as join type.
igalklebanov Sep 22, 2023
fbddc99
tighten using to JoinNode.
igalklebanov Sep 22, 2023
0fcb705
make table optional in UpdateQueryNode.
igalklebanov Sep 22, 2023
2dd3b25
add MergeQueryNode to RootOperationNode union.
igalklebanov Sep 22, 2023
07c1112
add SimpleTableReference type.
igalklebanov Sep 22, 2023
b232b73
add mergeInto to query creator.
igalklebanov Sep 22, 2023
0ee03a7
MergeQueryBuilder initial commit.
igalklebanov Sep 22, 2023
00bdcdc
handle when condition parsing.
igalklebanov Sep 22, 2023
3a3eb3f
handle matched then parsing.
igalklebanov Sep 22, 2023
ab72360
extract merge parser to own file.
igalklebanov Sep 22, 2023
152a19d
make into optional in insert query node.
igalklebanov Sep 22, 2023
238413f
add UT generic at insert query builder.
igalklebanov Sep 22, 2023
1a27106
implement not matched merge query builder methods.
igalklebanov Sep 22, 2023
106a588
export simple table reference.
igalklebanov Sep 22, 2023
e5ce1a4
handle merge query at with schema transformer.
igalklebanov Sep 22, 2023
c171dc2
add missing UT generic in remaining insert query builder references.
igalklebanov Sep 22, 2023
0296a57
small fixes.
igalklebanov Sep 22, 2023
4ef41ba
add MergeResult.
igalklebanov Sep 22, 2023
0dd9cb0
merge unit test suite initial commit.
igalklebanov Sep 22, 2023
8a2789c
add merge query node at query node.
igalklebanov Sep 23, 2023
8b5578b
add missing utility methods at merge query builder.
igalklebanov Sep 23, 2023
36fddd8
some js docs, generic rename, etc.
igalklebanov Sep 23, 2023
cb606b4
fix import.
igalklebanov Sep 23, 2023
2d53010
remove UT generic from InsertQueryBuilder.
igalklebanov Sep 23, 2023
98033e7
forgot to remove UT from query creator.
igalklebanov Sep 23, 2023
996bd1d
jsdocs at query creator.
igalklebanov Sep 24, 2023
b0935d4
minor API changes, js docs.
igalklebanov Sep 25, 2023
c936e45
prevent awaits, renames.
igalklebanov Sep 25, 2023
4ad72d1
export merge result.
igalklebanov Sep 25, 2023
4e6d072
excess generic.
igalklebanov Sep 25, 2023
d9f3e6f
some test cases.
igalklebanov Sep 25, 2023
2d46c08
Merge branch 'master' into merge
igalklebanov Sep 28, 2023
c861b5c
no parens around merge query update subquery.
igalklebanov Sep 29, 2023
d2b6db6
merge update test cases.
igalklebanov Sep 29, 2023
7495c48
not matched do nothing test case.
igalklebanov Sep 29, 2023
961d2d3
not matched insert values test cases.
igalklebanov Oct 4, 2023
3f93a37
matched and.
igalklebanov Oct 4, 2023
c414bf8
not matched and.
igalklebanov Oct 4, 2023
61a6889
remove only.
igalklebanov Oct 4, 2023
3451321
fix typings tests.
igalklebanov Oct 4, 2023
cb7c4e8
whenNotMatchedBySource*
igalklebanov Oct 4, 2023
52c29a0
whenNotMatchedBySource update fix.
igalklebanov Oct 4, 2023
79b23f8
test-d initial commit.
igalklebanov Nov 1, 2023
7e7deb7
test-d when not matched by source.
igalklebanov Nov 2, 2023
6553216
test-d then delete.
igalklebanov Nov 2, 2023
a7c66cd
test-d then update.
igalklebanov Nov 3, 2023
37076a2
test-d then insert.
igalklebanov Nov 3, 2023
3984e55
fix typings tests.
igalklebanov Nov 3, 2023
d7800c7
Merge branch 'master' into merge
igalklebanov Nov 5, 2023
2381102
Merge branch 'master' into merge
igalklebanov Nov 21, 2023
2c5da90
Merge branch 'master' into merge
igalklebanov Nov 21, 2023
9a66e5f
Merge branch 'master' into merge
igalklebanov Dec 29, 2023
b374fc1
Merge branch 'master' into merge
igalklebanov Dec 29, 2023
c3b52f8
Merge branch 'master' into merge
igalklebanov Dec 29, 2023
8fdb084
Merge branch 'master' into merge
igalklebanov Dec 29, 2023
bb7896c
Merge branch 'master' into merge
igalklebanov Dec 29, 2023
4b11475
Merge branch 'master' into merge
igalklebanov Dec 30, 2023
d1db041
Merge branch 'master' into merge
igalklebanov Dec 31, 2023
7ea1f1d
Merge branch 'master' into merge
igalklebanov Jan 6, 2024
e5228dc
Merge branch 'master' into merge
igalklebanov Jan 8, 2024
ba9708e
type perf.
igalklebanov Jan 8, 2024
3f34b81
type perf?
igalklebanov Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make into optional in insert query node.
igalklebanov committed Sep 22, 2023
commit 152a19d4cd50edcfe82c7e196a622ae5619086e8
8 changes: 7 additions & 1 deletion src/operation-node/insert-query-node.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ export type InsertQueryNodeProps = Omit<InsertQueryNode, 'kind' | 'into'>

export interface InsertQueryNode extends OperationNode {
readonly kind: 'InsertQueryNode'
readonly into: TableNode
readonly into?: TableNode
readonly columns?: ReadonlyArray<ColumnNode>
readonly values?: OperationNode
readonly returning?: ReturningNode
@@ -45,6 +45,12 @@ export const InsertQueryNode = freeze({
})
},

createWithoutInto(): InsertQueryNode {
return freeze({
kind: 'InsertQueryNode',
})
},

cloneWith(
insertQuery: InsertQueryNode,
props: InsertQueryNodeProps
6 changes: 4 additions & 2 deletions src/query-compiler/default-query-compiler.ts
Original file line number Diff line number Diff line change
@@ -295,8 +295,10 @@ export class DefaultQueryCompiler
this.append(' ignore')
}

this.append(' into ')
this.visitNode(node.into)
if (node.into) {
this.append(' into ')
this.visitNode(node.into)
}

if (node.columns) {
this.append(' (')