Class UpdateForClause

java.lang.Object
com.couchbase.client.java.query.dsl.clause.UpdateForClause

public class UpdateForClause
extends Object
UpdateForClause is a clause used in N1QL Updates, more specifically in the "set" part. For example: UPDATE bucket1 USE KEYS "abc123" SET "version.description" = "blabla" FOR variable IN path WHEN condition END;. This Clause allows you to produce an Expression that corresponds to "FOR variable IN path WHEN condition END".
Since:
2.2
Author:
Simon Baslé
  • Method Details

    • forIn

      public static UpdateForClause forIn​(String variable, String path)
      Creates an updateFor clause that starts with FOR variable IN path.
      Parameters:
      variable - the first variable in the clause.
      path - the first path in the clause, an IN path.
      Returns:
      the clause, for chaining. See when(Expression) and end() to complete the clause.
    • forWithin

      public static UpdateForClause forWithin​(String variable, String path)
      Creates an updateFor clause that starts with FOR variable WITHIN path.
      Parameters:
      variable - the first variable in the clause.
      path - the first path in the clause, a WITHIN path.
      Returns:
      the clause, for chaining. See when(Expression) and end() to complete the clause.
    • in

      public UpdateForClause in​(String variable, String path)
      Adds a "variable IN path" section to the clause.
      Parameters:
      variable - the next variable to add to the clause.
      path - the path for the variable, an IN path.
      Returns:
      the clause, for chaining. See when(Expression) and end() to complete the clause.
    • within

      public UpdateForClause within​(String variable, String path)
      Adds a "variable WITHIN path" section to the clause.
      Parameters:
      variable - the next variable to add to the clause.
      path - the path for the variable, a WITHIN path.
      Returns:
      the clause, for chaining. See when(Expression) and end() to complete the clause.
    • when

      public Expression when​(Expression condition)
      Terminates the clause by adding a condition to it ("WHEN condition END") and returns the corresponding Expression.
      Parameters:
      condition - the condition to add to the clause, in a WHEN section.
      Returns:
      the Expression representing the updateFor clause.
      See Also:
      if you don't need a condition.
    • end

      public Expression end()
      Terminates the clause without a particular WHEN condition ("END") and returns the corresponding Expression.
      Returns:
      the Expression representing the updateFor clause.
      See Also:
      if you need a condition.