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
”.
Modifier and Type | Method and Description |
---|---|
Expression |
end()
Terminates the clause without a particular WHEN condition (“
END ”) and returns the corresponding Expression . |
static UpdateForClause |
forIn(String variable,
String path)
Creates an updateFor clause that starts with
FOR variable IN path . |
static UpdateForClause |
forWithin(String variable,
String path)
Creates an updateFor clause that starts with
FOR variable WITHIN path . |
UpdateForClause |
in(String variable,
String path)
Adds a “
variable IN path ” section to the clause. |
Expression |
when(Expression condition)
Terminates the clause by adding a condition to it (“
WHEN condition END ”) and returns the corresponding Expression . |
UpdateForClause |
within(String variable,
String path)
Adds a “
variable WITHIN path ” section to the clause. |
public static UpdateForClause forIn(String variable, String path)
Creates an updateFor clause that starts with FOR variable IN path
.
variable
- the first variable in the clause.path
- the first path in the clause, an IN path.when(Expression)
and end()
to complete the clause.public static UpdateForClause forWithin(String variable, String path)
Creates an updateFor clause that starts with FOR variable WITHIN path
.
variable
- the first variable in the clause.path
- the first path in the clause, a WITHIN path.when(Expression)
and end()
to complete the clause.public UpdateForClause in(String variable, String path)
Adds a “variable IN path
” section to the clause.
variable
- the next variable to add to the clause.path
- the path for the variable, an IN path.when(Expression)
and end()
to complete the clause.public UpdateForClause within(String variable, String path)
Adds a “variable WITHIN path
” section to the clause.
variable
- the next variable to add to the clause.path
- the path for the variable, a WITHIN path.when(Expression)
and end()
to complete the clause.public Expression when(Expression condition)
Terminates the clause by adding a condition to it (“WHEN condition END
”) and returns the corresponding Expression
.
condition
- the condition to add to the clause, in a WHEN section.Expression
representing the updateFor clause.if you don't need a condition.
public Expression end()
Terminates the clause without a particular WHEN condition (“END
”) and returns the corresponding Expression
.
Expression
representing the updateFor clause.if you need a condition.
Copyright © 2015 Couchbase, Inc.