use super::{List, Query, Statement};
pub trait IntoScope<M> {
fn into_scope(self) -> Statement<List<M>>;
}
impl<M> IntoScope<M> for Query<List<M>> {
fn into_scope(self) -> Statement<List<M>> {
Statement::from_untyped_stmt(self.untyped.into())
}
}
impl<M> IntoScope<M> for Query<Option<M>> {
fn into_scope(self) -> Statement<List<M>> {
Statement::from_untyped_stmt(widen(self.untyped).into())
}
}
impl<M> IntoScope<M> for Query<M> {
fn into_scope(self) -> Statement<List<M>> {
Statement::from_untyped_stmt(widen(self.untyped).into())
}
}
fn widen(mut query: toasty_core::stmt::Query) -> toasty_core::stmt::Query {
if query.single {
query.single = false;
query.limit = None;
}
query
}