Skip to content

Commit 4fd7294

Browse files
committed
Fixed not in
1 parent f9f3705 commit 4fd7294

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ members = [
1111

1212
[package]
1313
name = "rorm"
14-
version = "0.9.4"
14+
version = "0.9.5"
1515
edition = "2021"
1616
repository = "https://github.com/rorm-orm/rorm"
1717
authors = ["gammelalf", "myOmikron <[email protected]>"]

src/conditions/in.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,28 @@ where
3232
B: Condition<'a>,
3333
{
3434
fn build(&self, mut builder: ConditionBuilder<'_, 'a>) {
35+
let bool_fallback;
36+
let collection_operator;
37+
let binary_operator;
38+
match self.operator {
39+
InOperator::In => {
40+
bool_fallback = false;
41+
collection_operator = CollectionOperator::Or;
42+
binary_operator = BinaryOperator::Equals;
43+
}
44+
InOperator::NotIn => {
45+
bool_fallback = true;
46+
collection_operator = CollectionOperator::And;
47+
binary_operator = BinaryOperator::NotEquals;
48+
}
49+
}
50+
3551
if self.snd_arg.is_empty() {
36-
Value::Bool(false).build(builder);
52+
Value::Bool(bool_fallback).build(builder);
3753
} else {
38-
builder.push_condition(FlatCondition::StartCollection(CollectionOperator::Or));
54+
builder.push_condition(FlatCondition::StartCollection(collection_operator));
3955
for snd_arg in self.snd_arg.iter() {
40-
builder.push_condition(FlatCondition::BinaryCondition(BinaryOperator::Equals));
56+
builder.push_condition(FlatCondition::BinaryCondition(binary_operator));
4157
self.fst_arg.build(builder.reborrow());
4258
snd_arg.build(builder.reborrow());
4359
}

0 commit comments

Comments
 (0)