Crate reql [−] [src]
Rust ReQL command reference
Submit issues and pull requests to our Github repository.
Accessing ReQL
Import this crate and bring the prelude into scope:-
extern crate reql;
use reql::prelude::*;
r
r -> r
The top-level ReQL namespace.
Examples
Setup your top-level namespace.
use reql::r;
Read more about this command →
connection
r.connection() → builder
Create a new connection to the database server. connection()
returns a builder object with the
following methods:
set_servers()
: the servers to connect to (defaultvec!["localhost:28015"]
).set_db()
: the default database (default"test"
).set_user()
: the user account to connect as (default"admin"
).set_password()
: the password for the user (default""
).set_retries()
: the number of times to retry a failed command (default5
).connect()
: create a connection pool and connect to all servers with the parameters previously passed to the builder.
If the connection cannot be established, an Error::Driver
will be returned.
Examples
Open a connection using the default host and port, specifying the default database.
r.connection().connect().expect("Failed to connect to the database server");
Read more about this command →
run
query.run() -> stream result
Run a query returning a futures stream receiver.
Examples
let users = try!(r.table("users").run::<User>());
let response = users.for_each(|user| {
println!("{:?}", user);
Ok(())
});
response.wait();
Read more about this command →
run_with_opts
query.run_with_opts(options) -> stream result
Run a query specifying certain options and returning a futures stream receiver.
Examples
let options = r.object()
.insert("profile", true)
.build();
let users = try!(r.table("users").run_with_opts::<User>(options));
let response = users.for_each(|user| {
println!("{:?}", user);
Ok(())
});
response.wait();
Read more about this command →
Modules
command |
Command Reference |
error |
Error Reference |
prelude |
Prelude |
Constants
r |
The top-level ReQL namespace |