Skip to content

Commit bbdc98f

Browse files
Zoran Cvetkovincrypto32
authored andcommitted
support immutable entities
1 parent eef5996 commit bbdc98f

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

store/postgres/src/block_range.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,27 @@ impl<'a> BlockRangeColumn<'a> {
288288
BlockRangeColumn::ImmutableRange {
289289
table: _,
290290
table_prefix: _,
291-
block_range: _,
291+
block_range: BlockRange(start, finish),
292292
} => {
293-
println!("ImmutableRange conatins()");
294-
todo!()
293+
out.push_sql("block$ >= ");
294+
match start {
295+
Bound::Included(block) => out.push_bind_param::<Integer, _>(block)?,
296+
Bound::Excluded(block) => {
297+
out.push_bind_param::<Integer, _>(block)?;
298+
out.push_sql("+1");
299+
}
300+
Bound::Unbounded => todo!(),
301+
};
302+
out.push_sql(" AND block$ <= ");
303+
match finish {
304+
Bound::Included(block) => {
305+
out.push_bind_param::<Integer, _>(block)?;
306+
out.push_sql("+1");
307+
}
308+
Bound::Excluded(block) => out.push_bind_param::<Integer, _>(block)?,
309+
Bound::Unbounded => todo!(),
310+
};
311+
Ok(())
295312
}
296313
}
297314
}

store/postgres/src/relational_queries.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ impl EntityData {
496496
.unwrap();
497497
let n = start.parse::<i32>().unwrap();
498498
Some(n)
499+
} else if key == "block$" {
500+
let block = json.as_i64().unwrap() as i32;
501+
Some(block)
499502
} else {
500503
None
501504
}

0 commit comments

Comments
 (0)