forked from dmfay/massive-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (34 loc) · 1.43 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
/** @module massive */
const Database = require('./lib/database');
/**
* Connect to Postgres and initialize the data mapper.
*
* @param {Object|String} connection - Connection configuration object, or
* connection string.
* @param {Object} [loader={}] - Change Massive's startup parameters. To
* blacklist or whitelist a schema or entity, provide its fully qualified name
* (eg myschema.mytable) as an array value or member in a comma-separated list.
* @param {Array|String} loader.blacklist - Omit specified tables and views.
* @param {Array|String} loader.whitelist - Omit all but the specified tables
* and views.
* @param {Array|String} loader.functionBlacklist - Omit specified functions.
* @param {Array|String} loader.functionWhitelist - Omit all but the specified
* functions.
* @param {Array|String} loader.allowedSchemas - Only load entities in the
* specified schemata.
* @param {Array|String} loader.exceptions - Omit specified tables and views.
* @param {String} loader.scripts - Define the scripts directory relative to the
* process working directory.
* @param {Object} [driverConfig={}] - Pass configuration directly to
* pg-promise.
*
* @return {Database} An initialized and connected data mapper.
*/
module.exports = (connection, loader = {}, driverConfig = {}) => {
return (new Database(connection, loader, driverConfig)).reload();
};
/**
* A database connection.
*/
module.exports.Database = Database;