Struct bonsaidb::core::test_util::UniqueValue
pub struct UniqueValue;
Trait Implementations§
§impl Clone for UniqueValue
impl Clone for UniqueValue
§fn clone(&self) -> UniqueValue
fn clone(&self) -> UniqueValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for UniqueValue
impl Debug for UniqueValue
§impl View for UniqueValue
impl View for UniqueValue
§type Collection = Unique
type Collection = Unique
The collection this view belongs to
§impl ViewSchema for UniqueValue
impl ViewSchema for UniqueValue
§type View = UniqueValue
type View = UniqueValue
The view this schema is defined for.
§fn unique(&self) -> bool
fn unique(&self) -> bool
If true, no two documents may emit the same key. Unique views are
updated when the document is saved, allowing for this check to be done
atomically. When a document is updated, all unique views will be
updated, and if any of them fail, the document will not be allowed to
update and an
Error::UniqueKeyViolation
will be
returned. Read more§fn map(
&self,
document: &BorrowedDocument<'_>
) -> Result<Mappings<<<UniqueValue as ViewSchema>::View as View>::Key, <<UniqueValue as ViewSchema>::View as View>::Value>, Error>
fn map(
&self,
document: &BorrowedDocument<'_>
) -> Result<Mappings<<<UniqueValue as ViewSchema>::View as View>::Key, <<UniqueValue as ViewSchema>::View as View>::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. See the user guide’s chapter on
views for more information on how map
works. Read more
§fn version(&self) -> u64
fn version(&self) -> u64
The version of the view. Changing this value will cause indexes to be rebuilt.
§fn reduce(
&self,
mappings: &[MappedValue<<Self::View as View>::Key, <Self::View as View>::Value>],
rereduce: bool
) -> Result<<Self::View as View>::Value, Error>
fn reduce(
&self,
mappings: &[MappedValue<<Self::View as View>::Key, <Self::View as View>::Value>],
rereduce: bool
) -> Result<<Self::View as View>::Value, Error>
Returns a value that is produced by reducing a list of
mappings
into a
single value. If rereduce
is true, the values contained in the
mappings have already been reduced at least one time. If an error of
ReduceUnimplemented
is returned,
queries that ask for a reduce operation will return an error. See the
user guide’s chapter on views for more information on how reduce
works. Read more