Skip to content

Commit

Permalink
basic: fix BasicQueryOpKind.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Oct 16, 2023
1 parent 145ba06 commit 92007ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions basic/src/basic_enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ pub enum BasicQueryOpKind {
#[oai(rename = "not_in")]
NotIn,
#[oai(rename = "is_null")]
IsNUll,
IsNull,
#[oai(rename = "is_not_null")]
IsNotNUll,
IsNotNull,
#[oai(rename = "is_not_null_or_empty")]
IsNullOrEmpty,
}
Expand All @@ -64,8 +64,8 @@ impl BasicQueryOpKind {
BasicQueryOpKind::NotLike => "NOT LIKE".to_string(),
BasicQueryOpKind::In => "IN".to_string(),
BasicQueryOpKind::NotIn => "NOT IN".to_string(),
BasicQueryOpKind::IsNUll => "IS NULL".to_string(),
BasicQueryOpKind::IsNotNUll => "IS NOT NULL".to_string(),
BasicQueryOpKind::IsNull => "IS NULL".to_string(),
BasicQueryOpKind::IsNotNull => "IS NOT NULL".to_string(),
BasicQueryOpKind::IsNullOrEmpty => "IS NULL".to_string(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions basic/src/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ impl BasicQueryCondInfo {
}
BasicQueryOpKind::In => check_val.as_array().map(|check_val_arr| check_val_arr.contains(&cond.value)).unwrap_or(false),
BasicQueryOpKind::NotIn => check_val.as_array().map(|check_val_arr| check_val_arr.contains(&cond.value)).unwrap_or(false),
BasicQueryOpKind::IsNUll => false,
BasicQueryOpKind::IsNotNUll => false,
BasicQueryOpKind::IsNull => false,
BasicQueryOpKind::IsNotNull => false,
BasicQueryOpKind::IsNullOrEmpty => false,
},
None => false,
Expand Down
4 changes: 2 additions & 2 deletions spi/spi-search/src/serv/es/search_es_item_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ fn gen_query_dsl(search_req: &SearchItemSearchReq) -> TardisResult<String> {
}
BasicQueryOpKind::NotLike => {}
BasicQueryOpKind::NotIn => {}
BasicQueryOpKind::IsNUll => {}
BasicQueryOpKind::IsNotNUll => {}
BasicQueryOpKind::IsNull => {}
BasicQueryOpKind::IsNotNull => {}
BasicQueryOpKind::IsNullOrEmpty => {}
}
}
Expand Down
12 changes: 6 additions & 6 deletions spi/spi-search/src/serv/pg/search_pg_item_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst,
for val in value {
sql_vals.push(val);
}
} else if ext_item.op == BasicQueryOpKind::IsNUll {
} else if ext_item.op == BasicQueryOpKind::IsNull {
where_fragments.push(format!("ext ->> '{}' is null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNotNUll {
} else if ext_item.op == BasicQueryOpKind::IsNotNull {
where_fragments.push(format!("ext ->> '{}' is not null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty {
where_fragments.push(format!("(ext ->> '{}' is null or ext ->> '{}' = '')", ext_item.field, ext_item.field));
Expand Down Expand Up @@ -427,9 +427,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst,
for val in value {
sql_vals.push(val);
}
} else if ext_item.op == BasicQueryOpKind::IsNUll {
} else if ext_item.op == BasicQueryOpKind::IsNull {
where_fragments.push(format!("ext ->> '{}' is null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNotNUll {
} else if ext_item.op == BasicQueryOpKind::IsNotNull {
where_fragments.push(format!("ext ->> '{}' is not null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty {
where_fragments.push(format!("(ext ->> '{}' is null or ext ->> '{}' = '')", ext_item.field, ext_item.field));
Expand Down Expand Up @@ -498,9 +498,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst,
sql_vals.push(Value::from(format!("{val}%")));
}
}
} else if ext_item.op == BasicQueryOpKind::IsNUll {
} else if ext_item.op == BasicQueryOpKind::IsNull {
sql_and_where.push(format!("{} is null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNotNUll {
} else if ext_item.op == BasicQueryOpKind::IsNotNull {
sql_and_where.push(format!("{} is not null", ext_item.field));
} else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty {
sql_and_where.push(format!("({} is null or {} = '')", ext_item.field, ext_item.field));
Expand Down

0 comments on commit 92007ec

Please sign in to comment.