-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* OutputNode. * add to insert query compilation. * QueryNode.cloneWithOutput. * OutputInterface with output method only. * enable returning @ mssql adapter. * add output to insert query builder. * add outputAll. * add to delete query compilation. * add to delete query builder. * add to update query compilation. * add to update query builder. * jsdocs. * supportsOutput. * supportsOutput. * use supportsOutput @ insert query builder. * use supportsOutput @ delete query builder. * use supportsOutput @ update query builder. * compilation fixes. * export output interface. * insert test cases. * delete test cases. * update test cases. * typings tests. * re-add test cases. * make supportsOutput optional. * remove unused imports. * add merge example to output jsdocs. * handle merge output compilation. * add output @ merge query builder. * transformer. * leftovers merge query builder. * some merge tests. * merge typings tests. * fix returning types.
- Loading branch information
1 parent
64a56f9
commit ecbcaf8
Showing
29 changed files
with
1,104 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { freeze } from '../util/object-utils.js' | ||
import { OperationNode } from './operation-node.js' | ||
|
||
export interface OutputNode extends OperationNode { | ||
readonly kind: 'OutputNode' | ||
readonly selections: ReadonlyArray<OperationNode> | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const OutputNode = freeze({ | ||
is(node: OperationNode): node is OutputNode { | ||
return node.kind === 'OutputNode' | ||
}, | ||
|
||
create(selections: ReadonlyArray<OperationNode>): OutputNode { | ||
return freeze({ | ||
kind: 'OutputNode', | ||
selections: freeze(selections), | ||
}) | ||
}, | ||
|
||
cloneWithSelections( | ||
output: OutputNode, | ||
selections: ReadonlyArray<OperationNode> | ||
): OutputNode { | ||
return freeze({ | ||
...output, | ||
selections: output.selections | ||
? freeze([...output.selections, ...selections]) | ||
: freeze(selections), | ||
}) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,29 @@ | ||
import { DeleteResult } from '../query-builder/delete-result.js' | ||
import { InsertResult } from '../query-builder/insert-result.js' | ||
import { MergeResult } from '../query-builder/merge-result.js' | ||
import { UpdateResult } from '../query-builder/update-result.js' | ||
import { Selection, AllSelection, CallbackSelection } from './select-parser.js' | ||
|
||
export type ReturningRow< | ||
DB, | ||
TB extends keyof DB, | ||
O, | ||
SE, | ||
> = O extends InsertResult | ||
export type ReturningRow<DB, TB extends keyof DB, O, SE> = O extends | ||
| InsertResult | ||
| DeleteResult | ||
| UpdateResult | ||
| MergeResult | ||
? Selection<DB, TB, SE> | ||
: O extends DeleteResult | ||
? Selection<DB, TB, SE> | ||
: O extends UpdateResult | ||
? Selection<DB, TB, SE> | ||
: O & Selection<DB, TB, SE> | ||
: O & Selection<DB, TB, SE> | ||
|
||
export type ReturningCallbackRow< | ||
DB, | ||
TB extends keyof DB, | ||
O, | ||
CB, | ||
> = O extends InsertResult | ||
export type ReturningCallbackRow<DB, TB extends keyof DB, O, CB> = O extends | ||
| InsertResult | ||
| DeleteResult | ||
| UpdateResult | ||
| MergeResult | ||
? CallbackSelection<DB, TB, CB> | ||
: O extends DeleteResult | ||
? CallbackSelection<DB, TB, CB> | ||
: O extends UpdateResult | ||
? CallbackSelection<DB, TB, CB> | ||
: O & CallbackSelection<DB, TB, CB> | ||
: O & CallbackSelection<DB, TB, CB> | ||
|
||
export type ReturningAllRow<DB, TB extends keyof DB, O> = O extends InsertResult | ||
export type ReturningAllRow<DB, TB extends keyof DB, O> = O extends | ||
| InsertResult | ||
| DeleteResult | ||
| UpdateResult | ||
| MergeResult | ||
? AllSelection<DB, TB> | ||
: O extends DeleteResult | ||
? AllSelection<DB, TB> | ||
: O extends UpdateResult | ||
? AllSelection<DB, TB> | ||
: O & AllSelection<DB, TB> | ||
: O & AllSelection<DB, TB> |
Oops, something went wrong.