Skip to content
Nameless edited this page Jun 6, 2018 · 14 revisions

Connection

To open a connection with luvit-reql you can do the following example.
Caution. If ran outside a coroutine, a callback function MUST be supplied on reql.connect

local luvitReQL = require('luvit-reql')
local connection = luvitReQL.connect(options, callback)

Callback

The callback must be a function and will be called with the connection after the driver has successfully connected to RethinkDB

  • Only called for Async Mode (reql.connect not called in a coroutine); ignored for Sync Mode (reql.connect called in a coroutine)

Options

Setting Default Type
address 127.0.0.1 string
port 28015 number
user admin string
password string
db test string
reconnect false boolean
reusable false boolean
debug false boolean
file luvitreql.log string

Raw:

local options = {
    address   = '127.0.0.1',
    port      = 28015,
    user      = 'admin',
    password  = '',
    db        = 'test',
    reconnect = false,
    reusable  = false,
    debug     = false,
    file      = 'luvitreql.log'
}

Options Explained

address

Specifies what address to connect to in ws(s)://address:port

port

Specifies what port to connect to in ws(s)://address:port

user

Specifies what user to authorize as

password

Specifies the password for the user above

db [Optional]

Specifies what db to use as default, equal to always using reql.db(name)

reconnect

Specifies whether or not to reconnect to RethinkDB automatically

reusable

Specifies whether or not you can use reql queries more than once

debug

Specifies whether or not debug mode should be enabled or not

Clone this wiki locally