Crate reql[−][src]
ReQL is the RethinkDB query language. It offers a very powerful and convenient way to manipulate JSON documents.
Start the server
Linux and OS X
Start the server from a terminal window.
$ rethinkdb
Windows
Start the server from the Windows command prompt.
C:\Path\To\RethinkDB\>rethinkdb.exe
Import the driver
First, make sure you have protoc
installed and in your PATH
. See
prost-build
documentation
for more details if it fails to compile.
Add this crate (reql
) and the futures
crate to your dependencies in Cargo.toml
.
Now import the RethinkDB driver:
use reql::r;
You can now access RethinkDB commands through the r
struct.
Open a connection
When you first start RethinkDB, the server opens a port for the client
drivers (28015
by default). Let’s open a connection:
use reql::r; let connection = r.connect(()).await?;
The variable connection
is now initialized and we can run queries.
Send a query to the database
use futures::TryStreamExt; use reql::r; let conn = r.connect(()).await?; let mut query = r.expr("Hello world!").run(&conn);
Modules
cmd |
Structs
Connection | The connection object returned by |
Query | The query that will be sent to RethinkDB |
r | The top-level ReQL namespace |
Enums
Availability | A server in the cluster is unavailable |
Client | An error has occurred within the driver |
Error | The most generic error message in ReQL |
Runtime | The parent class of all runtime errors |
Type Definitions
Result | Custom result returned by various ReQL commands |