Documentation

Comprehension extends Message
in package

A comprehension expression applied to a list or map.

Comprehensions are not part of the core syntax, but enabled with macros. A macro matches a specific call signature within a parsed AST and replaces the call with an alternate AST block. Macro expansion happens at parse time. The following macros are supported within CEL: Aggregate type macros may be applied to all elements in a list or all keys in a map:

  • all, exists, exists_one - test a predicate expression against the inputs and return true if the predicate is satisfied for all, any, or only one value list.all(x, x < 10).
  • filter - test a predicate expression against the inputs and return the subset of elements which satisfy the predicate: payments.filter(p, p > 1000).
  • map - apply an expression to all elements in the input and return the output aggregate type: [1, 2, 3].map(i, i * i). The has(m.x) macro tests whether the property x is present in struct m. The semantics of this macro depend on the type of m. For proto2 messages has(m.x) is defined as 'defined, but not set. For proto3, the macro tests whether the property is set to its default. For map and struct types, the macro tests whether the property xis defined onm`.

Generated from protobuf message google.api.expr.v1beta1.Expr.Comprehension

Table of Contents

Properties

$accu_init  : mixed
The initial value of the accumulator.
$accu_var  : mixed
The name of the variable used for accumulation of the result.
$iter_range  : mixed
The range over which var iterates.
$iter_var  : mixed
The name of the iteration variable.
$loop_condition  : mixed
An expression which can contain iter_var and accu_var.
$loop_step  : mixed
An expression which can contain iter_var and accu_var.
$result  : mixed
An expression which can contain accu_var.

Methods

__construct()  : mixed
Constructor.
clearAccuInit()  : mixed
clearIterRange()  : mixed
clearLoopCondition()  : mixed
clearLoopStep()  : mixed
clearResult()  : mixed
getAccuInit()  : Expr|null
The initial value of the accumulator.
getAccuVar()  : string
The name of the variable used for accumulation of the result.
getIterRange()  : Expr|null
The range over which var iterates.
getIterVar()  : string
The name of the iteration variable.
getLoopCondition()  : Expr|null
An expression which can contain iter_var and accu_var.
getLoopStep()  : Expr|null
An expression which can contain iter_var and accu_var.
getResult()  : Expr|null
An expression which can contain accu_var.
hasAccuInit()  : mixed
hasIterRange()  : mixed
hasLoopCondition()  : mixed
hasLoopStep()  : mixed
hasResult()  : mixed
setAccuInit()  : $this
The initial value of the accumulator.
setAccuVar()  : $this
The name of the variable used for accumulation of the result.
setIterRange()  : $this
The range over which var iterates.
setIterVar()  : $this
The name of the iteration variable.
setLoopCondition()  : $this
An expression which can contain iter_var and accu_var.
setLoopStep()  : $this
An expression which can contain iter_var and accu_var.
setResult()  : $this
An expression which can contain accu_var.

Properties

$accu_init

The initial value of the accumulator.

protected mixed $accu_init = null

Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4 [json_name = "accuInit"];

$accu_var

The name of the variable used for accumulation of the result.

protected mixed $accu_var = ''

Generated from protobuf field string accu_var = 3 [json_name = "accuVar"];

$iter_range

The range over which var iterates.

protected mixed $iter_range = null

Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2 [json_name = "iterRange"];

$iter_var

The name of the iteration variable.

protected mixed $iter_var = ''

Generated from protobuf field string iter_var = 1 [json_name = "iterVar"];

$loop_condition

An expression which can contain iter_var and accu_var.

protected mixed $loop_condition = null

Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5 [json_name = "loopCondition"];

$loop_step

An expression which can contain iter_var and accu_var.

protected mixed $loop_step = null

Computes the next value of accu_var.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6 [json_name = "loopStep"];

$result

An expression which can contain accu_var.

protected mixed $result = null

Computes the result.

Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7 [json_name = "result"];

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $data = NULL ]) : mixed
Parameters
$data : array<string|int, mixed> = NULL

{ Optional. Data for populating the Message object.

@type string $iter_var
      The name of the iteration variable.
@type \Google\Api\Expr\V1beta1\Expr $iter_range
      The range over which var iterates.
@type string $accu_var
      The name of the variable used for accumulation of the result.
@type \Google\Api\Expr\V1beta1\Expr $accu_init
      The initial value of the accumulator.
@type \Google\Api\Expr\V1beta1\Expr $loop_condition
      An expression which can contain iter_var and accu_var.
      Returns false when the result has been computed and may be used as
      a hint to short-circuit the remainder of the comprehension.
@type \Google\Api\Expr\V1beta1\Expr $loop_step
      An expression which can contain iter_var and accu_var.
      Computes the next value of accu_var.
@type \Google\Api\Expr\V1beta1\Expr $result
      An expression which can contain accu_var.
      Computes the result.

}

getAccuInit()

The initial value of the accumulator.

public getAccuInit() : Expr|null

Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4 [json_name = "accuInit"];

Return values
Expr|null

getAccuVar()

The name of the variable used for accumulation of the result.

public getAccuVar() : string

Generated from protobuf field string accu_var = 3 [json_name = "accuVar"];

Return values
string

getIterRange()

The range over which var iterates.

public getIterRange() : Expr|null

Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2 [json_name = "iterRange"];

Return values
Expr|null

getIterVar()

The name of the iteration variable.

public getIterVar() : string

Generated from protobuf field string iter_var = 1 [json_name = "iterVar"];

Return values
string

getLoopCondition()

An expression which can contain iter_var and accu_var.

public getLoopCondition() : Expr|null

Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5 [json_name = "loopCondition"];

Return values
Expr|null

getLoopStep()

An expression which can contain iter_var and accu_var.

public getLoopStep() : Expr|null

Computes the next value of accu_var.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6 [json_name = "loopStep"];

Return values
Expr|null

getResult()

An expression which can contain accu_var.

public getResult() : Expr|null

Computes the result.

Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7 [json_name = "result"];

Return values
Expr|null

setAccuInit()

The initial value of the accumulator.

public setAccuInit(Expr $var) : $this

Generated from protobuf field .google.api.expr.v1beta1.Expr accu_init = 4 [json_name = "accuInit"];

Parameters
$var : Expr
Return values
$this

setAccuVar()

The name of the variable used for accumulation of the result.

public setAccuVar(string $var) : $this

Generated from protobuf field string accu_var = 3 [json_name = "accuVar"];

Parameters
$var : string
Return values
$this

setIterRange()

The range over which var iterates.

public setIterRange(Expr $var) : $this

Generated from protobuf field .google.api.expr.v1beta1.Expr iter_range = 2 [json_name = "iterRange"];

Parameters
$var : Expr
Return values
$this

setIterVar()

The name of the iteration variable.

public setIterVar(string $var) : $this

Generated from protobuf field string iter_var = 1 [json_name = "iterVar"];

Parameters
$var : string
Return values
$this

setLoopCondition()

An expression which can contain iter_var and accu_var.

public setLoopCondition(Expr $var) : $this

Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_condition = 5 [json_name = "loopCondition"];

Parameters
$var : Expr
Return values
$this

setLoopStep()

An expression which can contain iter_var and accu_var.

public setLoopStep(Expr $var) : $this

Computes the next value of accu_var.

Generated from protobuf field .google.api.expr.v1beta1.Expr loop_step = 6 [json_name = "loopStep"];

Parameters
$var : Expr
Return values
$this

setResult()

An expression which can contain accu_var.

public setResult(Expr $var) : $this

Computes the result.

Generated from protobuf field .google.api.expr.v1beta1.Expr result = 7 [json_name = "result"];

Parameters
$var : Expr
Return values
$this

        
On this page

Search results