今天不練習設定自動化了,今天來好好帶大家認識 JQL 中常常會看到的運算符號,這樣一來,我們不會一直處於懂與不懂之間,會「開始懂了」。
學習參考來源 JQL operators
JQL 中的運算符是一個或多個符號或詞語,它比較左側字段的值與右側的一個或多個值(或函數),以使僅檢索到符合條件的結果。一些運算符可能使用 NOT 關鍵字。
今天要來認識
= | != | > | >= |
-- | -- | -- |
< | <= | ~ | !~ |
IN | NOT IN | IS | IS NOT |
WAS | WAS IN | WAS NOT IN | WAS NOT
CHANGED | | | |
reporter = "John Smith"
輸入 field != value 與輸入 NOT field = value 是相同的,field != EMPTY 與 field IS_NOT EMPTY 也是相同的。
reporter = currentUser() and assignee != currentUser()
duedate < now() and resolution is empty
created >= "-5d"
votes < 4
updated <= "-4w 2d"
上述 ">"、">="、"<"、"<=" 僅適用於支持排序的字段(例如日期和版本),無法與文句字段一起使用。
reporter IN (tom, jane, harry)
reporter = "tom" OR reporter = "jane" OR reporter = "harry"
reporter NOT IN (tom, jane, harry)
等同 reporter != "tom" AND reporter != "jane" AND reporter != "harry"
assignee not in (jack, jill)
assignee not in (jack, jill) 或 assignee is empty
summary ~ "win*"
summary ~ ""full screen""
summary !~ run
上述 "~"、"!~" 僅用於文本字段,即:Summary、Description、Environment、Comments等,用於 JQL 字段會加上 “text”。
fixVersion is empty
或 fixVersion is null
votes is not empty
或 votes is not null
status WAS "Resolved" BY jsmith BEFORE "2019/02/02"
status WAS "Resolved" BY abcde-12345-fedcba DURING ("2010/01/01","2011/01/01")
WAS IN:用於搜尋當前具有或以前具有指定字段的多個指定值之一的 issue。這些值以逗號分隔的列表形式在括號中指定。使用 "WAS IN" 等同於使用多個 WAS 聲明,但更簡潔和方便。
例如:搜尋現在有或以前有 “Resolved” 或 “In Progress” 狀態的所有 issues。status WAS IN ('Resolved', 'In Progress')
等同 status WAS "Resolved" OR status WAS "In Progress"
WAS NOT IN:用於搜尋字段的值從未是多個指定值之一的 issue。使用 "WAS NOT IN" 等於使用多個 WAS_NOT 聲明,但更簡潔和方便。
例如:搜尋從未具有 “Resolved” 或 “In Progress” 狀態的 issues。 status WAS NOT IN ("Resolved","In Progress")
等同 status WAS NOT "Resolved" AND status WAS NOT "In Progress"
例如:在2月2日之前,未曾到過 “Resolved” 或 “In Progress” 狀態的 issues。status WAS NOT IN ("Resolved","In Progress") BEFORE "2011/02/02"
status WAS NOT "In Progress" BEFORE "2011/02/02"
WAS、WAS IN、WAS NOT IN、WAS NOT 有以下可選述詞,如 AFTER "date"、BEFORE "date"、BY "username" or BY (username1,username2)、DURING ("date1","date2")、ON "date"。 僅適用於分配人(Assignee)、修復版本(Fix Version)、優先級(Priority)、報告人(Reporter)、解決方案(Resolution)和狀態(Status)字段。
priority CHANGED BY freddo BEFORE endOfWeek() AFTER startOfWeek()
有以下可選述詞AFTER "date"、BEFORE "date"、BY "username"、DURING ("date1","date2")、ON "date"、FROM "oldvalue"、TO "newvalue"。僅適用於分配人(Assignee)、修復版本(Fix Version)、優先級(Priority)、報告人(Reporter)、解決方案(Resolution)和狀態(Status)字段。
以上是 JQL operators(運算符號) 的解析的練習,不知對你而言有沒有幫助,但對我自己非常有幫助。