索引
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 |
選用。運算式的標題,即說明其用途的簡短字串。這可用在允許輸入運算式的 UI 中。 |
description |
選用。運算式的說明。這是一段較長的文字,用於說明運算式。例如,使用者在 UI 中將游標懸停在運算式上方時,即可顯示說明文字。 |
location |
選用。指出要提報錯誤的運算式所在位置,例如檔案名稱及檔案內的位置。 |
時間間隔
代表時間間隔,編碼以一個時間戳記開始 (含),一個時間戳記結束 (不含)。
開始時間必須小於或等於結束時間。如果開始時間等於結束時間,間隔會是空白 (不符合任何時間)。如果開始和結束時間都未指定,則間隔會符合任何時間。
| 欄位 | |
|---|---|
start_time |
選用。間隔的開始時間 (含)。 如果指定了這個值,符合此間隔的時間戳記必須等於或晚於開始時間。 |
end_time |
選用。間隔的結束時間 (不含)。 如果指定了這個值,符合此間隔的時間戳記必須早於結束時間。 |
金額
表示金額與貨幣類型。
| 欄位 | |
|---|---|
currency_code |
ISO 4217 定義的三碼貨幣代碼。 |
units |
金額的整數單位。舉例來說,如果 |
nanos |
金額的奈米 (10^-9) 單位數量。這個值必須介於 -999,999,999 和 +999,999,999 (含) 之間。如果 |