Struct rincon_session::CollectionSession
[−]
[src]
pub struct CollectionSession<C> { /* fields omitted */ }
A session for operating with a specific collection.
Methods
impl<C> CollectionSession<C> where
C: 'static + Connector,
[src]
C: 'static + Connector,
pub fn database_name(&self) -> &str
[src]
Returns the name of the database this collection is located in.
pub fn name(&self) -> &str
[src]
Returns the name of the collection this CollectionSession
operates
with.
pub fn entity(&self) -> Option<&Collection>
[src]
Returns the Collection
entity this CollectionSession
operates with.
It returns Some(&Collection)
if this session holds a loaded collection
entity or None
otherwise.
If the collection entity is not loaded the load()
function can be
used to get a session with a loaded collection entity.
pub fn unwrap(self) -> Entity<Collection>
[src]
Unwraps the collection entity out of this session which is either the
name of the collection or a Collection
instance.
pub fn is_entity(&self) -> bool
[src]
Returns whether this session holds a loaded collection entity.
It returns true if this session holds the collection entity or false
otherwise. If this function returns true the entity()
function will
return Some(&Collection)
otherwise that function returns None
.
pub fn fetch(self) -> Result<CollectionSession<C>>
[src]
Fetches the entity of the collection represented by this session and
returns a new CollectionSession
with the entity set in the session.
pub fn drop(self) -> Result<String>
[src]
Drops the collection that is represented by this session.
Returns the identifier of the collection if it has been dropped successfully.
After calling this function the associated CollectionSession
is no
longer valid.
pub fn rename<N>(self, new_name: N) -> Result<CollectionSession<C>> where
N: Into<String>,
[src]
N: Into<String>,
Renames the collection represented by this session and returns the
renamed collection as a new CollectionSession
.
pub fn get_revision(&self) -> Result<CollectionRevision>
[src]
Gets the revision of the collection represented by this session.
pub fn get_properties(&self) -> Result<CollectionProperties>
[src]
Gets the properties of the collection represented by this session.
pub fn change_properties(
&self,
properties: CollectionPropertiesUpdate
) -> Result<CollectionProperties>
[src]
&self,
properties: CollectionPropertiesUpdate
) -> Result<CollectionProperties>
Changes the properties of the collection represented by this session and returns the updated collection properties.
pub fn insert_document<D, T>(&self, document: D) -> Result<DocumentHeader> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts a new document into this collection.
pub fn insert_document_synced<D, T>(
&self,
document: D
) -> Result<DocumentHeader> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
document: D
) -> Result<DocumentHeader> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts a new document into this collection and waits until the changes are written to disk.
pub fn insert_document_return_new<D, T>(
&self,
document: D
) -> Result<Document<T>> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
document: D
) -> Result<Document<T>> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts a new document into this collection and returns the newly created document.
pub fn insert_document_return_new_synced<D, T>(
&self,
document: D
) -> Result<Document<T>> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
document: D
) -> Result<Document<T>> where
D: Into<NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts a new document into this collection, waits until the changes are written to disk and returns the newly created document
pub fn insert_documents<D, T>(
&self,
documents: D
) -> Result<ResultList<DocumentHeader>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
documents: D
) -> Result<ResultList<DocumentHeader>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts multiple documents into this collection.
pub fn insert_documents_synced<D, T>(
&self,
documents: D
) -> Result<ResultList<DocumentHeader>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
documents: D
) -> Result<ResultList<DocumentHeader>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts multiple documents into this collection and waits until the changes are written to disk.
pub fn insert_documents_return_new<D, T>(
&self,
documents: D
) -> Result<ResultList<Document<T>>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
documents: D
) -> Result<ResultList<Document<T>>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts multiple documents into this collection and returns the newly created documents.
pub fn insert_documents_return_new_synced<D, T>(
&self,
documents: D
) -> Result<ResultList<Document<T>>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
documents: D
) -> Result<ResultList<Document<T>>> where
D: IntoIterator<Item = NewDocument<T>>,
T: 'static + Serialize + DeserializeOwned + Debug,
Inserts multiple documents into this collection, waits until the changes are written to disk and returns the newly created documents.
pub fn get_document<T>(&self, key: DocumentKey) -> Result<Document<T>> where
T: 'static + DeserializeOwned,
[src]
T: 'static + DeserializeOwned,
Fetches the document with the given key from this collection.
pub fn get_document_if_match<IfMatch, T>(
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<T>> where
IfMatch: Into<String>,
T: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<T>> where
IfMatch: Into<String>,
T: 'static + DeserializeOwned,
Fetches the document with the given key from this collection if the revision matches the given predicate.
pub fn get_document_if_non_match<IfNonMatch, T>(
&self,
key: DocumentKey,
if_non_match: IfNonMatch
) -> Result<Document<T>> where
IfNonMatch: Into<String>,
T: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
if_non_match: IfNonMatch
) -> Result<Document<T>> where
IfNonMatch: Into<String>,
T: 'static + DeserializeOwned,
Fetches the document with the given key from this collection if the revision does not match the given predicate.
pub fn get_documents<Keys, T>(
&self,
keys: Keys
) -> Result<ResultList<Document<T>>> where
Keys: IntoIterator<Item = DocumentKey>,
T: 'static + DeserializeOwned,
[src]
&self,
keys: Keys
) -> Result<ResultList<Document<T>>> where
Keys: IntoIterator<Item = DocumentKey>,
T: 'static + DeserializeOwned,
Fetches multiple documents with the given keys from this collection.
pub fn replace_document<Old, New>(
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>
) -> Result<UpdatedDocument<Old, New>> where
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>
) -> Result<UpdatedDocument<Old, New>> where
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
Replaces an existing document with new content.
Arguments
key
: The key of the document to be replacednew_document
: The new content of the document
pub fn replace_document_if_match<IfMatch, Old, New>(
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
if_match: IfMatch
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
if_match: IfMatch
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
Replaces an existing document with new content if the match condition is met.
Arguments
key
: The key of the document to be replacednew_document
: The new content of the documentif_match
: The match condition that must be met to replace a document
pub fn replace_document_if_match_opt<IfMatch, Old, New>(
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
if_match: IfMatch,
options: DocumentReplaceOptions
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
if_match: IfMatch,
options: DocumentReplaceOptions
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
Replaces an existing document with new content if the match condition is met. This function allows to specify detailed options for the replace method.
Arguments
key
: The key of the document to be replacednew_document
: The new content of the documentif_match
: The match condition that must be met to replace a documentoptions
: Additional options for the replace method
pub fn replace_document_opt<Old, New>(
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
options: DocumentReplaceOptions
) -> Result<UpdatedDocument<Old, New>> where
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
[src]
&self,
key: DocumentKey,
new_document: DocumentUpdate<New>,
options: DocumentReplaceOptions
) -> Result<UpdatedDocument<Old, New>> where
Old: 'static + DeserializeOwned,
New: 'static + Serialize + DeserializeOwned + Debug,
Replaces an existing document with new content. This function allows to specify detailed options for the replace method.
Arguments
key
: The key of the document to be replacednew_document
: The new content of the documentoptions
: Additional options for the replace method
pub fn modify_document<Upd, Old, New>(
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>
) -> Result<UpdatedDocument<Old, New>> where
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>
) -> Result<UpdatedDocument<Old, New>> where
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
Partially modifies an existing document.
The update argument must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not exist yet or overwritten in the existing document if they already exist there.
Arguments
key
: The key of the document to be modifiedupdate
: A document with the content to be modified (patch document)
pub fn modify_document_if_match<IfMatch, Upd, Old, New>(
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
if_match: IfMatch
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
if_match: IfMatch
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
Partially modifies an existing document if the match condition is met.
The update argument must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not exist yet or overwritten in the existing document if they already exist there.
Arguments
key
: The key of the document to be modifiedupdate
: A document with the content to be modified (patch document)if_match
: The match condition that must be met to modify a document
pub fn modify_document_if_match_opt<IfMatch, Upd, Old, New>(
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
if_match: IfMatch,
options: DocumentModifyOptions
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
if_match: IfMatch,
options: DocumentModifyOptions
) -> Result<UpdatedDocument<Old, New>> where
IfMatch: Into<String>,
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
Partially modifies an existing document if the match condition is met. This function allows to specify detailed options for the modify method.
The update argument must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not exist yet or overwritten in the existing document if they already exist there.
Arguments
key
: The key of the document to be modifiedupdate
: A document with the content to be modified (patch document)if_match
: The match condition that must be met to modify a documentoptions
: Additional options for the modify method
pub fn modify_document_opt<Upd, Old, New>(
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
options: DocumentModifyOptions
) -> Result<UpdatedDocument<Old, New>> where
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
update: DocumentUpdate<Upd>,
options: DocumentModifyOptions
) -> Result<UpdatedDocument<Old, New>> where
Upd: 'static + Serialize + Debug,
Old: 'static + DeserializeOwned,
New: 'static + DeserializeOwned,
Partially modifies an existing document. This function allows to specify detailed options for the modify method.
The update argument must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not exist yet or overwritten in the existing document if they already exist there.
Arguments
key
: The key of the document to be modifiedupdate
: A document with the content to be modified (patch document)options
: Additional options for the modify method
pub fn delete_document(&self, key: DocumentKey) -> Result<DocumentHeader>
[src]
Deletes the document with the given key from this collection.
pub fn delete_document_if_match<IfMatch>(
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<DocumentHeader> where
IfMatch: Into<String>,
[src]
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<DocumentHeader> where
IfMatch: Into<String>,
Deletes the document with the given key from this collection if the match condition is met.
Arguments
key
: The key of the document to be deletedif_match
: The match condition that must be met to delete the document
pub fn delete_document_if_match_synced<IfMatch>(
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<DocumentHeader> where
IfMatch: Into<String>,
[src]
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<DocumentHeader> where
IfMatch: Into<String>,
Deletes the document with the given key from this collection if the match condition is met and waits until the changes are written to disk.
Arguments
key
: The key of the document to be deletedif_match
: The match condition that must be met to delete the document
pub fn delete_document_synced(&self, key: DocumentKey) -> Result<DocumentHeader>
[src]
Deletes the document with the given key from this collection and waits until the changes are written to disk.
pub fn delete_document_return_old<Old>(
&self,
key: DocumentKey
) -> Result<Document<Old>> where
Old: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey
) -> Result<Document<Old>> where
Old: 'static + DeserializeOwned,
Deletes the document with the given key from this collection and returns the deleted document.
pub fn delete_document_if_match_return_old<IfMatch, Old>(
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<Old>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<Old>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
Deletes the document with the given key from this collection if the match condition is met and returns the deleted document.
Arguments
key
: The key of the document to be deletedif_match
: The match condition that must be met to delete the document
pub fn delete_document_if_match_return_old_synced<IfMatch, Old>(
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<Old>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey,
if_match: IfMatch
) -> Result<Document<Old>> where
IfMatch: Into<String>,
Old: 'static + DeserializeOwned,
Deletes the document with the given key from this collection if the match condition is met, waits until the changes are written to disk and returns the deleted document.
Arguments
key
: The key of the document to be deletedif_match
: The match condition that must be met to delete the document
pub fn delete_document_return_old_synced<Old>(
&self,
key: DocumentKey
) -> Result<Document<Old>> where
Old: 'static + DeserializeOwned,
[src]
&self,
key: DocumentKey
) -> Result<Document<Old>> where
Old: 'static + DeserializeOwned,
Deletes the document with the given key from this collection, waits until the changes are written to disk and returns the deleted document.
pub fn ensure_hash_index<Fields>(
&self,
fields: Fields,
unique: bool,
sparse: bool,
deduplicate: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
[src]
&self,
fields: Fields,
unique: bool,
sparse: bool,
deduplicate: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
Creates a hash index for this collection if it does not exist already.
Arguments
fields
: A list of attribute pathsunique
: Whether a unique index shall be createdsparse
: A sparse index excludes documents from the index if they that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributesdeduplicate
: Whether to use deduplication of array values
pub fn ensure_skiplist_index<Fields>(
&self,
fields: Fields,
unique: bool,
sparse: bool,
deduplicate: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
[src]
&self,
fields: Fields,
unique: bool,
sparse: bool,
deduplicate: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
Creates a skip list index for this collection if it does not exist already.
Arguments
fields
: A list of attribute pathsunique
: Whether a unique index shall be createdsparse
: A sparse index excludes documents from the index if they that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributesdeduplicate
: Whether to use deduplication of array values
pub fn ensure_persistent_index<Fields>(
&self,
fields: Fields,
unique: bool,
sparse: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
[src]
&self,
fields: Fields,
unique: bool,
sparse: bool
) -> Result<Index> where
Fields: IntoIterator<Item = String>,
Creates a persistent index for this collection if it does not exist already.
Arguments
fields
: A list of attribute pathsunique
: Whether a unique index shall be createdsparse
: A sparse index excludes documents from the index if they that do not contain at least one of the specified index attributes (i.e. fields) or that have a value of null in any of the specified index attributes
pub fn ensure_geo_location_index<Loc>(
&self,
location_field: Loc,
geo_json: bool
) -> Result<Index> where
Loc: Into<String>,
[src]
&self,
location_field: Loc,
geo_json: bool
) -> Result<Index> where
Loc: Into<String>,
Creates a geo spatial index for this collection if it does not exist already.
Arguments
location_field
: The attribute path of the location fieldgeo_json
: If a geo-spatial index on a location is constructed andgeo_json
is true, then the order within the array is longitude followed by latitude.
pub fn ensure_geo_lat_lng_index<Lat, Lng>(
&self,
latitude_field: Lat,
longitude_field: Lng
) -> Result<Index> where
Lat: Into<String>,
Lng: Into<String>,
[src]
&self,
latitude_field: Lat,
longitude_field: Lng
) -> Result<Index> where
Lat: Into<String>,
Lng: Into<String>,
Creates a geo spatial index for this collection if it does not exist already.
Arguments
latitude_field
: The attribute path of the latitude fieldlongitude_field
: The attribute path of the longitude field
pub fn ensure_fulltext_index<Field>(
&self,
field: Field,
min_length: u32
) -> Result<Index> where
Field: Into<String>,
[src]
&self,
field: Field,
min_length: u32
) -> Result<Index> where
Field: Into<String>,
Creates a fulltext index for this collection if it does not exist already.
Arguments
field
: An attribute pathsmin_length
: Minimum character length of words to index
pub fn get_index(&self, key: IndexKey) -> Result<Index>
[src]
Fetches the index with the given key from this collection.
pub fn delete_index(&self, key: IndexKey) -> Result<IndexIdOption>
[src]
Deletes the index with the given key from this collection.