/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::{
fmt::Display,
ops::{Bound, RangeBounds},
};
use rusqlite::ToSql;
/// Formats a pair of range bounds as an SQL expression that /// constrains the range of a projected column. /// /// Depending on whether the range is bounded or unbounded in /// either direction, the fragment can bind zero, one, or two /// SQL parameters. pubstruct RangeFragment<'a, T> {
column: &'a str,
start: Bound<&'a T>,
end: Bound<&'a T>,
}
impl<'a, T> RangeFragment<'a, T> where
T: ToSql,
{ /// If the range has a lower bound, returns the name and value of the /// SQL parameter to add to the `[rusqlite::Params]` slice for the /// statement containing this fragment. pubfn start_param(&self) -> Option<(&'static str, &dyn ToSql)> { match &self.start {
Bound::Included(key) | Bound::Excluded(key) => Some((":start", key)),
Bound::Unbounded => None,
}
}
/// If the range has an upper bound, returns the name and value of the /// SQL parameter to add to the `[rusqlite::Params]` slice for the /// statement containing this fragment. pubfn end_param(&self) -> Option<(&'static str, &dyn ToSql)> { match &self.end {
Bound::Included(key) | Bound::Excluded(key) => Some((":end", key)),
Bound::Unbounded => None,
}
}
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-06-20)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.