Diesel 动态添加 filter
使用 into_boxed
e.g.
let mut qs = files_dsl::files
.offset(offset)
.limit(limit)
.order(ordering.order())
.select(File::as_select()).into_boxed();
if and_tags.len() > 0 {
qs = qs.filter(files::tags.contains(and_tags.clone()));
}
if exclude_tags.len() > 0 {
qs = qs.filter(files::tags.overlaps_with(exclude_tags.clone()).eq(false))
}
if tags.len() > 0 {
qs = qs.filter(files::tags.overlaps_with(tags.clone()));
}