A Rust Client for OrientDB. Supports sync and async (tokio and async-std)
Install from crates.io
toml
[dependencies]
orientdb_client = "*"
```rust
use orientdb_client::{OrientDB};
fn main() -> Result<(), Box
let session = client.session("demodb","admin","admin")?;
let results : Vec<_> = session.query("select from V where id = :param").named(&[("param", &1)]).run()?.collect();
println!("{:?}", results);
Ok(())
} ```
For async-std
activate the feature async-std-runtime
orientdb-client = { version = "*", features = ["async-std-runtime"] }
```rust use asyncstd::task::blockon; use futures::StreamExt; use orientdbclient::aio::OrientDB; use orientdbclient::OrientResult;
fn main() -> OrientResult<()> { block_on(async { let client = OrientDB::connect(("localhost", 2424)).await?;
let session = client.session("demodb", "admin", "admin").await?;
let mut stream = session.query("select from V limit 10").run().await?;
while let Some(item) = stream.next().await {
println!("Record {:?}", item?);
}
Ok(())
})
} ```
For tokio
activate the feature tokio-runtime
orientdb-client = { version = "*", features = ["tokio-runtime"] }
```rust use futures::StreamExt; use orientdbclient::aio::OrientDB; use orientdbclient::OrientResult;
async fn main() -> OrientResult<()> { let client = OrientDB::connect(("localhost", 2424)).await?;
let session = client.session("demodb", "admin", "admin").await?;
let mut stream = session.query("select from V limit 10").run().await?;
while let Some(item) = stream.next().await {
println!("Record {:?}", item?);
}
Ok(())
} ```
git clone https://github.com/wolf4ood/orientdb-rs.git
cd orientdb-rs
cargo build
You can use docker-compose to start an instance for testing. Use the env variable ORIENTDB_SERVER
in order to specify the version of OrientDB
cd docker-compose
export ORIENTDB_SERVER=3.0.23
docker-compose up -d
cd ..
cargo test