The rincon_session provides a convenient API for synchronous communication with an [ArangoDB] server.
The [rinconsession API] is a higher level API on top of the [rinconclient API] and provides additional features:
Here is an example on how inserting a new document into an existing collection looks like:
```rust
struct Customer { name: String, age: u8, }
// obtain a session reference for the existing collection named customers
let collection = database.usecollectionwith_name("customers");
let customer = Customer { name: "Jane Doe".to_owned(), age: 42, };
// insert the document and get the document header with document id, key and revision let documentheader = collection.insertdocument(customer).unwrap(); ```
The rincon_session is part of the Rincon ArangoDB Rust driver project.
Note: A similar but asynchronous API is provided by the [rinconsessionasync] crate which is also part of the [Rincon project].
To use the synchronous session API of this crate add this to your Cargo.toml
:
toml
[dependencies]
rincon_core = "0.1"
rincon_connection = "0.1"
rincon_session = "0.1"
And this to your crate root:
rust
extern crate rincon_core;
extern crate rincon_connection;
extern crate rincon_session;
Important: As [rinconsession] depends on [rinconclient] it re-exports the crate features of [rinconclient]. Therefore please make sure that you specify the features for [rinconsession] that are suitable for the setup of your [ArangoDB] server the same way as specified for the [rincon_client] crate.
For example to use [rincon_session] with an [ArangoDB] server configured to use RocksDB in a cluster specify the dependency with features like so:
toml
[dependencies]
rincon_session = { version = "0.1", default-features = false, features = ["rocksdb", "cluster"] }
Licensed under Apache License, Version 2.0
see [LICENSE] or http://www.apache.org/licenses/LICENSE-2.0 for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.