Interface ManipulationResult

All Superinterfaces:
BaseResult
All Known Subinterfaces:
InsertionBatchResult<T>, InsertionResult, ManipulationBatchResult<T>
All Known Implementing Classes:
InsertionBatchResultImpl, InsertionResultImpl, ManipulationBatchResultImpl, ManipulationResultImpl

public interface ManipulationResult extends BaseResult
The ManipulationResult interface represents the result of a manipulation operation, such as an insert, update, or delete operation.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether at least one row was changed.
    default void
    Executes the given consumer if at least one row was changed.
    default void
    Executes the provided consumers based on the result of a manipulation operation.
    default void
    Executes the given Consumer if the ManipulationResult has no changes.
    default boolean
    Checks whether the manipulation operation was successful.
    int
    Returns the total number of changed rows resulting from a manipulation operation.

    Methods inherited from interface de.chojo.sadu.queries.api.results.BaseResult

    exceptions, hasExceptions
  • Method Details

    • rows

      int rows()
      Returns the total number of changed rows resulting from a manipulation operation.
      Returns:
      the total number of changed rows
    • changed

      boolean changed()
      Checks whether at least one row was changed.
      Returns:
      true if one row or more were changed
    • isSuccess

      default boolean isSuccess()
      Checks whether the manipulation operation was successful.

      Success is determined by the absence of any exceptions and at least one row being changed.

      Returns:
      true if the operation was successful, false otherwise.
    • ifChanged

      default void ifChanged(Consumer<Integer> consumer)
      Executes the given consumer if at least one row was changed.
      Parameters:
      consumer - the consumer to execute if rows were changed
    • ifEmpty

      default void ifEmpty(Consumer<ManipulationResult> notChanged)
      Executes the given Consumer if the ManipulationResult has no changes.
      Parameters:
      notChanged - the Consumer to execute
    • ifChangedOrElse

      default void ifChangedOrElse(Consumer<Integer> changed, Consumer<ManipulationResult> notChanged)
      Executes the provided consumers based on the result of a manipulation operation.
      Parameters:
      changed - The consumer to be executed if at least one row was changed. Holds the changed rows count
      notChanged - The consumer to be executed if no rows were changed. Holds the result itself.
      See Also: