Browse Source

ui/sqlite3: add flag query support

tags/pre-alpha-0.4.0
Manos Pitsidianakis 3 months ago
parent
commit
6ce88667c0
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS. GPG Key ID: 73627C2F690DF710
1 changed files with 43 additions and 0 deletions
  1. +43
    -0
      ui/src/sqlite3.rs

+ 43
- 0
ui/src/sqlite3.rs View File

@@ -418,6 +418,49 @@ pub fn query_to_sql(q: &Query) -> String {
rec(q, s);
s.push_str(") ");
}
Flags(v) => {
let total = v.len();
if total > 1 {
s.push_str("(");
}
for (i, f) in v.iter().enumerate() {
match f.as_str() {
"draft" => {
s.push_str(" (flags & 8 > 0) ");
}
"deleted" | "trashed" => {
s.push_str(" (flags & 6 > 0) ");
}
"flagged" => {
s.push_str(" (flags & 16 > 0) ");
}
"recent" => {
s.push_str(" (flags & 4 == 0) ");
}
"seen" | "read" => {
s.push_str(" (flags & 4 > 0) ");
}
"unseen" | "unread" => {
s.push_str(" (flags & 4 == 0) ");
}
"answered" | "replied" => {
s.push_str(" (flags & 2 > 0) ");
}
"unanswered" => {
s.push_str(" (flags & 2 == 0) ");
}
_ => {
continue;
}
}
if total > 1 && i != total - 1 {
s.push_str(" AND ");
}
}
if total > 1 {
s.push_str(") ");
}
}
_ => {}
}
}


Loading…
Cancel
Save