Trait pliantdb::local::core::schema::View [−][src]
A map/reduce powered indexing and aggregation schema.
Inspired by CouchDB
’s view
system
This implementation is under active development, our own docs explaining our implementation will be written as things are solidified.
Associated Types
type Collection: Collection
[src]
The collection this view belongs to
type Key: 'static + Key
[src]
The key for this view.
type Value: Serialize + for<'de> Deserialize<'de> + Send + Sync
[src]
An associated type that can be stored with each entry in the view.
Required methods
pub fn version(&self) -> u64
[src]
The version of the view. Changing this value will cause indexes to be rebuilt.
pub fn name(&self) -> Cow<'static, str>
[src]
The name of the view. Must be unique per collection.
pub fn map(
&self,
document: &Document<'_>
) -> Result<Option<Map<Self::Key, Self::Value>>, Error>
[src]
&self,
document: &Document<'_>
) -> Result<Option<Map<Self::Key, Self::Value>>, Error>
The map function for this view. This function is responsible for emitting entries for any documents that should be contained in this View. If None is returned, the View will not include the document.
Provided methods
pub fn reduce(
&self,
mappings: &[MappedValue<Self::Key, Self::Value>],
rereduce: bool
) -> Result<Self::Value, Error>
[src]
&self,
mappings: &[MappedValue<Self::Key, Self::Value>],
rereduce: bool
) -> Result<Self::Value, Error>
The reduce function for this view. If Err(Error::ReduceUnimplemented)
is returned, queries that ask for a reduce operation will return an
error. See CouchDB
’s Reduce/Rereduce
documentation
for the design this implementation will be inspired by
Implementors
impl View for BasicByBrokenParentId
[src]
type Collection = Basic
type Key = ()
type Value = ()
pub fn version(&self) -> u64
[src]
pub fn name(&self) -> Cow<'static, str>
[src]
pub fn map(
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByBrokenParentId as View>::Key, <BasicByBrokenParentId as View>::Value>>, Error>
[src]
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByBrokenParentId as View>::Key, <BasicByBrokenParentId as View>::Value>>, Error>
impl View for BasicByCategory
[src]
type Collection = Basic
type Key = String
type Value = usize
pub fn version(&self) -> u64
[src]
pub fn name(&self) -> Cow<'static, str>
[src]
pub fn map(
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByCategory as View>::Key, <BasicByCategory as View>::Value>>, Error>
[src]
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByCategory as View>::Key, <BasicByCategory as View>::Value>>, Error>
pub fn reduce(
&self,
mappings: &[MappedValue<<BasicByCategory as View>::Key, <BasicByCategory as View>::Value>],
_rereduce: bool
) -> Result<<BasicByCategory as View>::Value, Error>
[src]
&self,
mappings: &[MappedValue<<BasicByCategory as View>::Key, <BasicByCategory as View>::Value>],
_rereduce: bool
) -> Result<<BasicByCategory as View>::Value, Error>
impl View for BasicByParentId
[src]
type Collection = Basic
type Key = Option<u64>
type Value = usize
pub fn version(&self) -> u64
[src]
pub fn name(&self) -> Cow<'static, str>
[src]
pub fn map(
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByParentId as View>::Key, <BasicByParentId as View>::Value>>, Error>
[src]
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicByParentId as View>::Key, <BasicByParentId as View>::Value>>, Error>
pub fn reduce(
&self,
mappings: &[MappedValue<<BasicByParentId as View>::Key, <BasicByParentId as View>::Value>],
_rereduce: bool
) -> Result<<BasicByParentId as View>::Value, Error>
[src]
&self,
mappings: &[MappedValue<<BasicByParentId as View>::Key, <BasicByParentId as View>::Value>],
_rereduce: bool
) -> Result<<BasicByParentId as View>::Value, Error>
impl View for BasicCount
[src]
type Collection = Basic
type Key = ()
type Value = usize
pub fn version(&self) -> u64
[src]
pub fn name(&self) -> Cow<'static, str>
[src]
pub fn map(
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicCount as View>::Key, <BasicCount as View>::Value>>, Error>
[src]
&self,
document: &Document<'_>
) -> Result<Option<Map<<BasicCount as View>::Key, <BasicCount as View>::Value>>, Error>
pub fn reduce(
&self,
mappings: &[MappedValue<<BasicCount as View>::Key, <BasicCount as View>::Value>],
_rereduce: bool
) -> Result<<BasicCount as View>::Value, Error>
[src]
&self,
mappings: &[MappedValue<<BasicCount as View>::Key, <BasicCount as View>::Value>],
_rereduce: bool
) -> Result<<BasicCount as View>::Value, Error>