PostgreSQL

PostgreSQL

new PostgreSQL()

Source:

PostgreSQL client class

Members

client :pg.Client

Source:
See:

pg client

Type:
  • pg.Client

Methods

addGuild(guild) → {Promise.<pg.QueryResult>}

Source:

Adds a guild to the database if it isn't in there already

Parameters:
Name Type Description
guild Eris.Guild
Returns:
Type
Promise.<pg.QueryResult>

connect() → {Promise.<void>}

Source:

Connects the client to the database

Returns:
Type
Promise.<void>

disconnect() → {Promise.<void>}

Source:

Disconnects the client from the database

Returns:
Type
Promise.<void>

insert(table, data) → {Promise.<pg.QueryResult>}

Source:

Insert data into a table

Parameters:
Name Type Description
table string

Table to query

data *

Data to insert

Returns:
Type
Promise.<pg.QueryResult>

rawQuery(query) → {Promise.<string>}

Source:

Execute a raw query (command)

Parameters:
Name Type Description
query string

Query, eg: SELECT * FROM guilds;

Returns:
Type
Promise.<string>

select(table, expression) → {Promise.<pg.QueryResult>}

Source:

Select data from database

Example
PostgreSQL.select('nyan', 'id = "awoo"')
Parameters:
Name Type Description
table string

Table to query

expression string

Expression, eg: id = 123456, name = "awoo"

Returns:
Type
Promise.<pg.QueryResult>

update(table, expression, data) → {Promise.<pg.QueryResult>}

Source:

Update data in a table

Example
PostgreSQL.update('nya', 'id = "awoo"', { reee: true });
Parameters:
Name Type Description
table string

Table to query

expression string

Expression, eg: id = 123456, name = "awoo"

data *

New data

Returns:
Type
Promise.<pg.QueryResult>