索引
Expr
(消息)
Expr
表示采用通用表达式语言 (CEL) 语法的文本表达式。CEL 是一种类似于 C 的表达式语言。有关 CEL 的语法和语义,请参见https://github.com/google/cel-spec。
示例(比较):
title: "Summary size limit"
description: "Determines if a summary is less than 100 chars"
expression: "document.summary.size() < 100"
示例(相等):
title: "Requestor is owner"
description: "Determines if requestor is the document owner"
expression: "document.owner == request.auth.claims.email"
示例(逻辑):
title: "Public documents"
description: "Determine whether the document should be publicly visible"
expression: "document.type != 'private' && document.type != 'internal'"
示例(数据操纵):
title: "Notification string"
description: "Create a notification string with a timestamp."
expression: "'New message received at ' + string(document.create_time)"
可以在表达式内引用的确切变量和函数由计算该表达式的服务决定。如需了解详情,请参阅服务文档。
字段 | |
---|---|
expression |
采用通用表达式语言语法的表达式的文本表示法。 |
title |
可选。表达式的标题,即说明表达式用途的短字符串。该标题可用于允许输入表达式的内容(例如界面)中。 |
description |
可选。表达式的说明。该说明是描述表达式的较长文本,例如在界面中将鼠标悬停在表达式上时显示的文本。 |
location |
可选。此字符串指示用于错误报告的表达式的位置,例如文件名和文件中的位置。 |