Expand description
§Unofficial RethinkDB Driver for Rust
Well documented and easy to use
§Import
use unreql::r;
§Connect
use unreql::{r, cmd::connect::Options};
let conn = r.connect(Options::new().db("marvel")).await?;
§Get data
Get by ID
let user: User = r.table("users").get(1).exec(&conn).await?;
Get all data
let users: Vec<User> = r.table("users").exec_to_vec(&conn).await?;
or
use futures::TryStreamExt;
let mut cur = r.table("users").run::<_, User>(&conn);
while let Ok(Some(user)) = cur.try_next().await {
// do something with user
dbg!(user);
}
§Update data
use unreql::{r, rjson};
r.table("users")
.get(1)
.update(rjson!({
"name": "Jonh",
"upd_count": r.row().g("upd_count").add(1),
}))
.run::<_, serde_json::Value>(&conn);
Re-exports§
Modules§
Macros§
Structs§
- The connection object returned by
r.connect()
- The top-level ReQL namespace
Enums§
- A server in the cluster is unavailable
- The query that will be sent to RethinkDB
- An error has occurred within the driver
- The most generic error message in ReQL
- The parent class of all runtime errors
Type Aliases§
- Custom result returned by various ReQL commands