Struct reindeer::QueryBuilder
source · pub struct QueryBuilder<'a> { /* private fields */ }
Expand description
QueryBuilder
is a convenient way to build query to target several conditions without the need to immediately
serialize/deserialize data from disk.
For simplicity’s sake, ids are expressed as &[u8]
. To get the key of an entity using this type,
just use &entity.get_key().as_bytes()
.
Execute the query with get
or get_single
, providing the Db instance to run it on.
Implementations§
source§impl<'a> QueryBuilder<'a>
impl<'a> QueryBuilder<'a>
sourcepub fn new() -> QueryBuilder<'a>
pub fn new() -> QueryBuilder<'a>
Creates a new Query Builder.
sourcepub fn with_ids(&mut self, ids: &mut Vec<&impl AsBytes>) -> &mut QueryBuilder<'a>
pub fn with_ids(&mut self, ids: &mut Vec<&impl AsBytes>) -> &mut QueryBuilder<'a>
Specifies an array of ids to consider in this query. This can be used multiple times.
sourcepub fn with_id(&mut self, id: &impl AsBytes) -> &mut QueryBuilder<'a>
pub fn with_id(&mut self, id: &impl AsBytes) -> &mut QueryBuilder<'a>
Specifies an single id to consider in this query. This can be used multiple times to specify several ids.
sourcepub fn with_parent(&mut self, id: &impl AsBytes) -> &mut QueryBuilder<'a>
pub fn with_parent(&mut self, id: &impl AsBytes) -> &mut QueryBuilder<'a>
Specifies that this entity is the child of a given parent. This implies that the queried store is marked as a child of another entity type.
sourcepub fn with_named_relation_to<OT: Entity>(
&mut self,
id: &impl AsBytes,
name: &'a str
) -> &mut QueryBuilder<'a>
pub fn with_named_relation_to<OT: Entity>( &mut self, id: &impl AsBytes, name: &'a str ) -> &mut QueryBuilder<'a>
Specifies that a named relation to another entity has to exist. This can be used multiple times to specify several conditions.
sourcepub fn with_relation_to<OT: Entity>(
&mut self,
id: &impl AsBytes
) -> &mut QueryBuilder<'a>
pub fn with_relation_to<OT: Entity>( &mut self, id: &impl AsBytes ) -> &mut QueryBuilder<'a>
Specifies that an unnamed relation to another entity has to exist. This can be used multiple times to specify several conditions.