Skip to content

Go ReQL command reference

Daniel Cannon edited this page May 16, 2015 · 2 revisions

Accessing ReQL

All ReQL queries begin from the top-level module.

  • Connect - Connect creates a new database session. To view the available connection options see ConnectOpts.
  • Close - Close closes the session
  • Reconnect - Reconnect closes and re-opens a session.
  • Run - Run runs a query using the given connection.
  • RunWrite - RunWrite runs a query using the given connection but unlike Run automatically scans the result into a variable of type WriteResponss. This function should be used if you are running a write query (such as Insert, Update, TableCreate, etc...)
  • Exec - Exec runs the query but does not return the result.
  • NoReplyWait - NoReplyWait ensures that previous queries with the noreply flag have been processed by the server. Note that this guarantee only applies to queries run on the given connection.

Cursors

  • Next - Next retrieves the next document from the result set, blocking if necessary.
  • All - All retrieves all documents from the result set into the provided slice and closes the cursor.
  • One - One retrieves a single document from the result set into the provided slice and closes the cursor.
  • Listen - Listen listens for rows from the database and sends the result onto the given channel
  • IsNil - IsNil tests if the current row is nil.
  • Err - Err returns nil if no errors happened during iteration, or the actual error otherwise.
  • Close - Close closes the cursor, preventing further enumeration.

Manipulating databases

Manipulating tables

Writing data

Selecting data

Joins

Transformations

Aggregation

Document manipulation

String manipulation

Math and logic

Dates and times

Control structures

  • Args - Args is a special term that’s used to splice an array of arguments into another term.
  • Binary - Encapsulate binary data within a query.
  • Do - Call an anonymous function using return values from other ReQL commands or queries as arguments.
  • Branch - Evaluate one of two control paths based on the value of an expression.
  • ForEach - Loop over a sequence, evaluating the given write query for each element.
  • Range - Generate a stream of sequential integers in a specified range.
  • Error - Throw a runtime error.
  • Default - Handle non-existence errors.
  • Expr - Construct a ReQL JSON value from a native type.
  • JS - Create a javascript expression.
  • CoerceTo - Convert a value of one type into another.
  • TypeOf - Gets the type of a value.
  • Info - Get information about a ReQL value.
  • JSON - Parse a JSON string on the server.
  • ToJSON - Convert a ReQL value or object to a JSON string.
  • HTTP - Retrieve data from the specified URL over HTTP.
  • UUID - Return a UUID (universally unique identifier), a string that can be used as a unique ID.

Geospatial commands

  • Circle - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Distance - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Fill - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • GeoJSON - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • ToGeoJSON - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • GetIntersecting - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • GetNearest - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Includes - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Intersects - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Line - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Point - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • Polygon - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • PolygonSub - Return a UUID (universally unique identifier), a string that can be used as a unique ID.
  • UUID - Return a UUID (universally unique identifier), a string that can be used as a unique ID.

Clone this wiki locally