Home Reference Source Repository

Function

Static Public Summary
public

connect(r: *, objectPattern1: {"host": *, "port": *, "db": *, "maxAttempts": *, "baseTimeout": *, "maxTimeout": *}): *

connect to the db, using .attemptToConnect internally.

public

ensureDB(r: *, conn: *, dbName: *): *

makes sure a db exists by attempting to create it and suppressing the error if it already exists.

public

ensureIndex(r: *, conn: *, tableName: *, indexName: *, indexCreateOptions: ...*): *

ensure that an index exists on a table, creating if necessary.

public

ensureTable(r: *, conn: *, tableName: *): *

makes sure a table exists by attempting to create it and suppressing the error if it already exists.

Static Public

public connect(r: *, objectPattern1: {"host": *, "port": *, "db": *, "maxAttempts": *, "baseTimeout": *, "maxTimeout": *}): * source

connect to the db, using .attemptToConnect internally.

by default will continue to try connecting every timeout milliseconds (default 1000ms = 1s).

Params:

NameTypeAttributeDescription
r *
objectPattern1 {"host": *, "port": *, "db": *, "maxAttempts": *, "baseTimeout": *, "maxTimeout": *}
  • optional
  • default: {}

Return:

*

public ensureDB(r: *, conn: *, dbName: *): * source

makes sure a db exists by attempting to create it and suppressing the error if it already exists.

Params:

NameTypeAttributeDescription
r *
conn *
dbName *

Return:

*

[Promise<boolean>] true if the db was created.

public ensureIndex(r: *, conn: *, tableName: *, indexName: *, indexCreateOptions: ...*): * source

import {ensureIndex} from '@nrser/supermodel-rethinkdb/src/util.js'

ensure that an index exists on a table, creating if necessary.

returns Promise<boolean> that resolved true if the index was created and false if it was already there.

Params:

NameTypeAttributeDescription
r *
conn *
tableName *
indexName *
indexCreateOptions ...*

Return:

*

public ensureTable(r: *, conn: *, tableName: *): * source

import {ensureTable} from '@nrser/supermodel-rethinkdb/src/util.js'

makes sure a table exists by attempting to create it and suppressing the error if it already exists.

Params:

NameTypeAttributeDescription
r *
conn *
tableName *

Return:

*

[Promise<boolean>] true if the table was created.