Class MergeWhenMatchedStep<DTO,MUS extends MergeUpdateStep,MIS extends MergeInsertStep>

Type Parameters:
DTO - the type of the DTO
MUS - operation mode-specific WHEN MATCHED update step
MIS - operation mode-specific WHEN NOT MATCHED insert step
Direct Known Subclasses:
MergeOnConditionClauseTerminal

public sealed class MergeWhenMatchedStep<DTO,MUS extends MergeUpdateStep,MIS extends MergeInsertStep> extends MergeWhenNotMatchedStep<MIS> permits MergeOnConditionClauseTerminal<DTO,SELF,MUS,MIS,QCB>
Merge step for setting up WHEN MATCHED and/or WHEN NOT MATCHED clauses.
  • Constructor Details

    • MergeWhenMatchedStep

      public MergeWhenMatchedStep(MergeNode mergeNode, QueryNode node, LitebridgeContext litebridgeContext)
      Creates a new MergeWhenMatchedStep instance.
      Parameters:
      mergeNode - root merge node
      node - current query node
      litebridgeContext - Litebridge context
  • Method Details

    • whenMatched

      public MergeWhenMatchedStep<DTO,MUS,MIS> whenMatched(Function<MUS,MergeTerminal> update)
      Creates a WHEN MATCHED clause.

      A WHEN MATCHED AND conditional clause can be added by including a WHERE clause in the specified update function.

      The update function defines the WHEN MATCHED THEN behaviour to take when a match occurs in the MERGE operation. This method allows specifying the action to perform, typically an update or delete, through a provided function that operates on a MergeUpdateStep. Any WHERE conditions added to the MergeUpdateStep will be applied as part of the WHEN MATCHED AND clause.

      Parameters:
      update - a Function that accepts a MergeUpdateStep and produces a MergeTerminal. The function is used to define the specific update or delete operation to be executed for matched rows.
      Returns:
      this instance of MergeWhenMatchedStep for further chaining of merge match clauses.