I want to add conditional filter on joined table:
let query = first_table::table.into_boxed();
if Some(filter_string) = filter {
// ERROR: inner_join() generates value of new type,
// cannot assign it to boxed query
query = query
.inner_join(joined_table::table.on(...))
.filter(jointed_table::dsl::string_field.eq(filter_string))
}
// joined_table actually is not required here
let result = query.select(first_table::all_columns).load(...)?;
Is there a way to downcast type of modified query into original one's, or may be there's another way to do that without copy-pasting final chain .select().load() into condition?