Crate reql[−][src]
Expand description
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 session = r.connect(()).await?;
The variable connection is now initialized and we can run queries.
Send a query to the database
r.expr("Hello world!").run(conn)
Modules
| cmd | |
| types | Common ReQL data types |
Macros
| func |
Structs
| Connection | |
| Query | The query that will be sent to RethinkDB |
| Session | The connection object returned by |
| r | The top-level ReQL namespace |
Enums
| Availability | A server in the cluster is unavailable |
| Driver | 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 |