Trait bonsaidb::core::connection::LowLevelConnection
pub trait LowLevelConnection: HasSchema + HasSession {
Show 27 methods
// Required methods
fn apply_transaction(
&self,
transaction: Transaction
) -> Result<Vec<OperationResult, Global>, Error>;
fn get_from_collection(
&self,
id: DocumentId,
collection: &CollectionName
) -> Result<Option<OwnedDocument>, Error>;
fn get_multiple_from_collection(
&self,
ids: &[DocumentId],
collection: &CollectionName
) -> Result<Vec<OwnedDocument, Global>, Error>;
fn list_from_collection(
&self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &CollectionName
) -> Result<Vec<OwnedDocument, Global>, Error>;
fn list_headers_from_collection(
&self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &CollectionName
) -> Result<Vec<Header, Global>, Error>;
fn count_from_collection(
&self,
ids: Range<DocumentId>,
collection: &CollectionName
) -> Result<u64, Error>;
fn compact_collection_by_name(
&self,
collection: CollectionName
) -> Result<(), Error>;
fn query_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<Vec<Serialized, Global>, Error>;
fn query_by_name_with_docs(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedSerializedDocuments, Error>;
fn reduce_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<Vec<u8, Global>, Error>;
fn reduce_grouped_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<Vec<MappedSerializedValue, Global>, Error>;
fn delete_docs_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<u64, Error>;
// Provided methods
fn insert<C, PrimaryKey, B>(
&self,
id: Option<&PrimaryKey>,
contents: B
) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>
where C: Collection,
B: Into<Bytes> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + Send + ?Sized { ... }
fn update<C, D>(&self, doc: &mut D) -> Result<(), Error>
where C: Collection,
D: Document<C> + Send + Sync { ... }
fn overwrite<C, PrimaryKey>(
&self,
id: &PrimaryKey,
contents: Vec<u8, Global>
) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>
where C: Collection,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> { ... }
fn get<C, PrimaryKey>(
&self,
id: &PrimaryKey
) -> Result<Option<OwnedDocument>, Error>
where C: Collection,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + ?Sized { ... }
fn get_multiple<'id, C, PrimaryKey, DocumentIds, I>(
&self,
ids: DocumentIds
) -> Result<Vec<OwnedDocument, Global>, Error>
where C: Collection,
DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync,
I: Iterator<Item = &'id PrimaryKey> + Send + Sync,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + ?Sized { ... }
fn list<'id, C, R, PrimaryKey>(
&self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Result<Vec<OwnedDocument, Global>, Error>
where C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey> { ... }
fn list_headers<'id, C, R, PrimaryKey>(
&self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Result<Vec<Header, Global>, Error>
where C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey> { ... }
fn count<'id, C, R, PrimaryKey>(&self, ids: R) -> Result<u64, Error>
where C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey> { ... }
fn delete<C, H>(&self, doc: &H) -> Result<(), Error>
where C: Collection,
H: HasHeader + Send + Sync { ... }
fn query<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>, Global>, Error>
where V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key> { ... }
fn query_with_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedDocuments<OwnedDocument, V>, Error>
where V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key> { ... }
fn query_with_collection_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>
where Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: SerializedView,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug { ... }
fn reduce<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<<V as View>::Value, Error>
where V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key> { ... }
fn reduce_grouped<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>, Global>, Error>
where V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key> { ... }
fn delete_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<u64, Error>
where V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key> { ... }
}
Expand description
The low-level interface to a database’s schema::Schema
, giving access to
Collection
s and
Views
s. This trait is not safe to use within async
contexts and will block the current thread. For async access, use
AsyncLowLevelConnection
.
This trait’s methods are not designed for ergonomics. See
Connection
for a higher-level interface.
Required Methods§
fn apply_transaction(
&self,
transaction: Transaction
) -> Result<Vec<OperationResult, Global>, Error>
fn apply_transaction( &self, transaction: Transaction ) -> Result<Vec<OperationResult, Global>, Error>
Applies a Transaction
to the schema::Schema
. If any operation in the
Transaction
fails, none of the operations will be applied to the
schema::Schema
.
fn get_from_collection(
&self,
id: DocumentId,
collection: &CollectionName
) -> Result<Option<OwnedDocument>, Error>
fn get_from_collection( &self, id: DocumentId, collection: &CollectionName ) -> Result<Option<OwnedDocument>, Error>
Retrieves the document with id
stored within the named collection
.
This is a lower-level API. For better ergonomics, consider using one of:
fn get_multiple_from_collection(
&self,
ids: &[DocumentId],
collection: &CollectionName
) -> Result<Vec<OwnedDocument, Global>, Error>
fn get_multiple_from_collection( &self, ids: &[DocumentId], collection: &CollectionName ) -> Result<Vec<OwnedDocument, Global>, Error>
Retrieves all documents matching ids
from the named collection
.
Documents that are not found are not returned, but no error will be
generated.
This is a lower-level API. For better ergonomics, consider using one of:
fn list_from_collection(
&self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &CollectionName
) -> Result<Vec<OwnedDocument, Global>, Error>
fn list_from_collection( &self, ids: Range<DocumentId>, order: Sort, limit: Option<u32>, collection: &CollectionName ) -> Result<Vec<OwnedDocument, Global>, Error>
Retrieves all documents within the range of ids
from the named
collection
. To retrieve all documents, pass in ..
for ids
.
This is a lower-level API. For better ergonomics, consider using one of:
fn list_headers_from_collection(
&self,
ids: Range<DocumentId>,
order: Sort,
limit: Option<u32>,
collection: &CollectionName
) -> Result<Vec<Header, Global>, Error>
fn list_headers_from_collection( &self, ids: Range<DocumentId>, order: Sort, limit: Option<u32>, collection: &CollectionName ) -> Result<Vec<Header, Global>, Error>
Retrieves all headers within the range of ids
from the named
collection
. To retrieve all documents, pass in ..
for ids
.
This is a lower-level API. For better ergonomics, consider using one of:
fn count_from_collection(
&self,
ids: Range<DocumentId>,
collection: &CollectionName
) -> Result<u64, Error>
fn count_from_collection( &self, ids: Range<DocumentId>, collection: &CollectionName ) -> Result<u64, Error>
Counts the number of documents within the range of ids
from the named
collection
.
This is a lower-level API. For better ergonomics, consider using one of:
fn compact_collection_by_name(
&self,
collection: CollectionName
) -> Result<(), Error>
fn compact_collection_by_name( &self, collection: CollectionName ) -> Result<(), Error>
Compacts the collection to reclaim unused disk space.
This process is done by writing data to a new file and swapping the file once the process completes. This ensures that if a hardware failure, power outage, or crash occurs that the original collection data is left untouched.
Errors
Error::CollectionNotFound
: databasename
does not exist.Error::Other
: an error occurred while compacting the database.
fn query_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<Vec<Serialized, Global>, Error>
fn query_by_name( &self, view: &ViewName, key: Option<SerializedQueryKey>, order: Sort, limit: Option<u32>, access_policy: AccessPolicy ) -> Result<Vec<Serialized, Global>, Error>
Queries for view entries from the named view
.
This is a lower-level API. For better ergonomics, consider querying the
view using View::entries(self).query()
instead. The
parameters for the query can be customized on the builder returned from
Connection::view()
.
fn query_by_name_with_docs(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedSerializedDocuments, Error>
fn query_by_name_with_docs( &self, view: &ViewName, key: Option<SerializedQueryKey>, order: Sort, limit: Option<u32>, access_policy: AccessPolicy ) -> Result<MappedSerializedDocuments, Error>
Queries for view entries from the named view
with their source
documents.
This is a lower-level API. For better ergonomics, consider querying the
view using
View::entries(self).query_with_docs()
instead. The parameters for the query can be customized on the builder
returned from Connection::view()
.
fn reduce_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<Vec<u8, Global>, Error>
fn reduce_by_name( &self, view: &ViewName, key: Option<SerializedQueryKey>, access_policy: AccessPolicy ) -> Result<Vec<u8, Global>, Error>
Reduces the view entries from the named view
.
This is a lower-level API. For better ergonomics, consider reducing the
view using View::entries(self).reduce()
instead. The parameters for the query can be customized on the builder
returned from Connection::view()
.
fn reduce_grouped_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<Vec<MappedSerializedValue, Global>, Error>
fn reduce_grouped_by_name( &self, view: &ViewName, key: Option<SerializedQueryKey>, access_policy: AccessPolicy ) -> Result<Vec<MappedSerializedValue, Global>, Error>
Reduces the view entries from the named view
, reducing the values by each
unique key.
This is a lower-level API. For better ergonomics, consider reducing
the view using
View::entries(self).reduce_grouped()
instead.
The parameters for the query can be customized on the builder returned
from Connection::view()
.
fn delete_docs_by_name(
&self,
view: &ViewName,
key: Option<SerializedQueryKey>,
access_policy: AccessPolicy
) -> Result<u64, Error>
fn delete_docs_by_name( &self, view: &ViewName, key: Option<SerializedQueryKey>, access_policy: AccessPolicy ) -> Result<u64, Error>
Deletes all source documents for entries that match within the named
view
.
This is a lower-level API. For better ergonomics, consider querying the
view using
View::entries(self).delete_docs()
instead. The parameters for the query can be customized on the builder
returned from Connection::view()
.
Provided Methods§
fn insert<C, PrimaryKey, B>(
&self,
id: Option<&PrimaryKey>,
contents: B
) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>where
C: Collection,
B: Into<Bytes> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + Send + ?Sized,
fn insert<C, PrimaryKey, B>( &self, id: Option<&PrimaryKey>, contents: B ) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>where C: Collection, B: Into<Bytes> + Send, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + Send + ?Sized,
Inserts a newly created document into the connected schema::Schema
for the Collection
C
. If id
is None
a unique id will be
generated. If an id is provided and a document already exists with that
id, a conflict error will be returned.
This is the lower-level API. For better ergonomics, consider using one of:
fn update<C, D>(&self, doc: &mut D) -> Result<(), Error>where
C: Collection,
D: Document<C> + Send + Sync,
fn update<C, D>(&self, doc: &mut D) -> Result<(), Error>where C: Collection, D: Document<C> + Send + Sync,
Updates an existing document in the connected schema::Schema
for the
Collection
C
. Upon success, doc.revision
will be updated with
the new revision.
This is the lower-level API. For better ergonomics, consider using one of:
fn overwrite<C, PrimaryKey>(
&self,
id: &PrimaryKey,
contents: Vec<u8, Global>
) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>where
C: Collection,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey>,
fn overwrite<C, PrimaryKey>( &self, id: &PrimaryKey, contents: Vec<u8, Global> ) -> Result<CollectionHeader<<C as Collection>::PrimaryKey>, Error>where C: Collection, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey>,
Overwrites an existing document, or inserts a new document. Upon success,
doc.revision
will be updated with the new revision information.
This is the lower-level API. For better ergonomics, consider using one of:
fn get<C, PrimaryKey>(
&self,
id: &PrimaryKey
) -> Result<Option<OwnedDocument>, Error>where
C: Collection,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + ?Sized,
fn get<C, PrimaryKey>( &self, id: &PrimaryKey ) -> Result<Option<OwnedDocument>, Error>where C: Collection, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + ?Sized,
Retrieves a stored document from Collection
C
identified by id
.
This is a lower-level API. For better ergonomics, consider using one of:
fn get_multiple<'id, C, PrimaryKey, DocumentIds, I>(
&self,
ids: DocumentIds
) -> Result<Vec<OwnedDocument, Global>, Error>where
C: Collection,
DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync,
I: Iterator<Item = &'id PrimaryKey> + Send + Sync,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + ?Sized,
fn get_multiple<'id, C, PrimaryKey, DocumentIds, I>( &self, ids: DocumentIds ) -> Result<Vec<OwnedDocument, Global>, Error>where C: Collection, DocumentIds: IntoIterator<Item = &'id PrimaryKey, IntoIter = I> + Send + Sync, I: Iterator<Item = &'id PrimaryKey> + Send + Sync, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + 'id + ?Sized,
Retrieves all documents matching ids
. Documents that are not found are
not returned, but no error will be generated.
This is a lower-level API. For better ergonomics, consider using one of:
fn list<'id, C, R, PrimaryKey>(
&self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Result<Vec<OwnedDocument, Global>, Error>where
C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
fn list<'id, C, R, PrimaryKey>( &self, ids: R, order: Sort, limit: Option<u32> ) -> Result<Vec<OwnedDocument, Global>, Error>where C: Collection, R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized, <C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Retrieves all documents within the range of ids
. To retrieve all
documents, pass in ..
for ids
.
This is a lower-level API. For better ergonomics, consider using one of:
fn list_headers<'id, C, R, PrimaryKey>(
&self,
ids: R,
order: Sort,
limit: Option<u32>
) -> Result<Vec<Header, Global>, Error>where
C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
fn list_headers<'id, C, R, PrimaryKey>( &self, ids: R, order: Sort, limit: Option<u32> ) -> Result<Vec<Header, Global>, Error>where C: Collection, R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized, <C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Retrieves all documents within the range of ids
. To retrieve all
documents, pass in ..
for ids
.
This is the lower-level API. For better ergonomics, consider using one of:
fn count<'id, C, R, PrimaryKey>(&self, ids: R) -> Result<u64, Error>where
C: Collection,
R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send,
PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized,
<C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
fn count<'id, C, R, PrimaryKey>(&self, ids: R) -> Result<u64, Error>where C: Collection, R: Into<RangeRef<'id, <C as Collection>::PrimaryKey, PrimaryKey>> + Send, PrimaryKey: KeyEncoding<<C as Collection>::PrimaryKey> + PartialEq<PrimaryKey> + 'id + ?Sized, <C as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
Counts the number of documents within the range of ids
.
This is a lower-level API. For better ergonomics, consider using one of:
fn delete<C, H>(&self, doc: &H) -> Result<(), Error>where
C: Collection,
H: HasHeader + Send + Sync,
fn delete<C, H>(&self, doc: &H) -> Result<(), Error>where C: Collection, H: HasHeader + Send + Sync,
Removes a Document
from the database.
This is a lower-level API. For better ergonomics, consider using one of:
fn query<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>, Global>, Error>where
V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
fn query<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, order: Sort, limit: Option<u32>, access_policy: AccessPolicy ) -> Result<Vec<CollectionMap<<<V as View>::Collection as Collection>::PrimaryKey, <V as View>::Key, <V as View>::Value>, Global>, Error>where V: SerializedView, Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>,
Queries for view entries matching View
.
This is a lower-level API. For better ergonomics, consider querying the
view using View::entries(self).query()
instead. The
parameters for the query can be customized on the builder returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.
fn query_with_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedDocuments<OwnedDocument, V>, Error>where
V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
fn query_with_docs<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, order: Sort, limit: Option<u32>, access_policy: AccessPolicy ) -> Result<MappedDocuments<OwnedDocument, V>, Error>where V: SerializedView, Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>,
Queries for view entries matching View
with their
source documents.
This is a lower-level API. For better ergonomics, consider querying the
view using
View::entries(self).query_with_docs()
instead. The parameters for the query can be customized on the builder
returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.
fn query_with_collection_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
order: Sort,
limit: Option<u32>,
access_policy: AccessPolicy
) -> Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>where
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
V: SerializedView,
<V as View>::Collection: SerializedCollection,
<<V as View>::Collection as SerializedCollection>::Contents: Debug,
fn query_with_collection_docs<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, order: Sort, limit: Option<u32>, access_policy: AccessPolicy ) -> Result<MappedDocuments<CollectionDocument<<V as View>::Collection>, V>, Error>where Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>, V: SerializedView, <V as View>::Collection: SerializedCollection, <<V as View>::Collection as SerializedCollection>::Contents: Debug,
Queries for view entries matching View
with their
source documents, deserialized.
This is a lower-level API. For better ergonomics, consider querying the
view using
View::entries(self).query_with_collection_docs()
instead. The parameters for the query can be customized on the builder
returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.
fn reduce<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<<V as View>::Value, Error>where
V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
fn reduce<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, access_policy: AccessPolicy ) -> Result<<V as View>::Value, Error>where V: SerializedView, Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>,
Reduces the view entries matching View
.
This is a lower-level API. For better ergonomics, consider reducing the
view using View::entries(self).reduce()
instead. The parameters for the query can be customized on the builder
returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.
fn reduce_grouped<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>, Global>, Error>where
V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
fn reduce_grouped<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, access_policy: AccessPolicy ) -> Result<Vec<MappedValue<<V as View>::Key, <V as View>::Value>, Global>, Error>where V: SerializedView, Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>,
Reduces the view entries matching View
, reducing the
values by each unique key.
This is a lower-level API. For better ergonomics, consider reducing the
view using
View::entries(self).reduce_grouped()
instead. The parameters for the query can be customized on the builder
returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.
fn delete_docs<V, Key>(
&self,
key: Option<QueryKey<'_, <V as View>::Key, Key>>,
access_policy: AccessPolicy
) -> Result<u64, Error>where
V: SerializedView,
Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized,
<V as View>::Key: Borrow<Key> + PartialEq<Key>,
fn delete_docs<V, Key>( &self, key: Option<QueryKey<'_, <V as View>::Key, Key>>, access_policy: AccessPolicy ) -> Result<u64, Error>where V: SerializedView, Key: KeyEncoding<<V as View>::Key> + PartialEq<Key> + ?Sized, <V as View>::Key: Borrow<Key> + PartialEq<Key>,
Deletes all of the documents associated with this view.
This is a lower-level API. For better ergonomics, consider querying the
view using
View::entries(self).delete_docs()
instead. The parameters for the query can be customized on the builder
returned from
SerializedView::entries()
,
SerializedView::entries_async()
,
or Connection::view()
.