|
@@ -2,6 +2,7 @@ use crate::{
|
|
db::{StatementContext, StatementRow},
|
|
db::{StatementContext, StatementRow},
|
|
schema::entity::{Entity, EntityVisitor},
|
|
schema::entity::{Entity, EntityVisitor},
|
|
schema::relation::{Relation, RelationData, RelationDomain, RelationMap, RelationRange},
|
|
schema::relation::{Relation, RelationData, RelationDomain, RelationMap, RelationRange},
|
|
|
|
+ schema::{Serializable, Serialized},
|
|
DBResult,
|
|
DBResult,
|
|
};
|
|
};
|
|
|
|
|
|
@@ -137,12 +138,18 @@ pub trait DatumVisitor {
|
|
/// Note that this is abstracted across [`ConcreteDatum`] and not [`Datum`]; this is to avoid
|
|
/// Note that this is abstracted across [`ConcreteDatum`] and not [`Datum`]; this is to avoid
|
|
/// issues with [`StringQuery`] -- which is not concrete -- having two implementations of
|
|
/// issues with [`StringQuery`] -- which is not concrete -- having two implementations of
|
|
/// `QueryEquivalent<StringQuery>`: one from the reflexive implementation and one from (2) above.
|
|
/// `QueryEquivalent<StringQuery>`: one from the reflexive implementation and one from (2) above.
|
|
-pub trait QueryEquivalent<T: ConcreteDatum>: Datum {}
|
|
|
|
|
|
+pub trait QueryEquivalent<T>: Datum {}
|
|
|
|
|
|
// Every type is query-equivalent to itself.
|
|
// Every type is query-equivalent to itself.
|
|
impl<T: ConcreteDatum> QueryEquivalent<T> for T {}
|
|
impl<T: ConcreteDatum> QueryEquivalent<T> for T {}
|
|
// Every reference type is query-equivalent to the non-referenced type.
|
|
// Every reference type is query-equivalent to the non-referenced type.
|
|
impl<'l, T: ConcreteDatum> QueryEquivalent<T> for &'l T {}
|
|
impl<'l, T: ConcreteDatum> QueryEquivalent<T> for &'l T {}
|
|
|
|
+// Any type is query-equivalent to the serialized type.
|
|
|
|
+impl<T: 'static + DatumProxy + Datum + Serializable> QueryEquivalent<Serialized<T>> for T {}
|
|
|
|
+
|
|
|
|
+/// Used as a marker trait for types that on their own, are not [`Datum`]s, but can be turned into
|
|
|
|
+/// one in a query-equivalent fashion.
|
|
|
|
+pub trait DatumProxy: Serializable {}
|
|
|
|
|
|
/// Used if you wish to use sqlite's built-in string equivalence for a query.
|
|
/// Used if you wish to use sqlite's built-in string equivalence for a query.
|
|
#[derive(Clone, Debug)]
|
|
#[derive(Clone, Debug)]
|