Crate reql

source ·
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)

See the r struct for more available commands

Modules

Macros

Structs

  • The query that will be sent to RethinkDB
  • The connection object returned by r.connect()
  • The top-level ReQL namespace

Enums

  • A server in the cluster is unavailable
  • An error has occurred within the driver
  • The most generic error message in ReQL
  • The parent class of all runtime errors

Type Definitions

  • Custom result returned by various ReQL commands