Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Interface Database

Configurations for a MySQL server.

Example

These are placed in config/database.cfg.js.

module.exports = {
    Queue: 20,
    Config: {
        user: 'root',
        password: 'p@55w012d',
        database: 'mysql', // The DB
        connectionLimit: 50,
        multipleStatements: true,
        debug: false,
        keepAlive: 300000
    },
    Pool: {
        Server1: {
            host: 'localhost:3001',
        },
        Server2: {
            host: 'localhost:3002',
        },
        Server3: {
            host: 'localhost:3003',
        },
    }
};

Hierarchy

  • Database

Index

Properties

Properties

Queue

Queue: number

The amount of connection to have queued at any given time.

default

5

Config

Config: Options

The global options of a MySQLServer connection. Any properties set here (that are allowed in CFG.MSQL.Pool) will be applied to any Pools within CFG.Database.Pool if said properties are left unset.

Pool

Pool: object

A configuration collection of multiple MySQLPools. Any properties left unset within a particular Pool will use those set within CFG.Database.Config (or it's defaults if said properties are left unset).

Example:

    Config: {
        user:     'myusename',
        password: 'mYp@55w012d',
        database: 'mydatabase',
    },
    // Both Pools will inherit Config['user','password' & 'database'].
    Pool: {
        Server1: { host: '1.2.3.4' }, // 1st Pool
        Server2: { host: 'db.mydomain.com' }, // 2nd Pool
        // ...
    }

Type declaration

  • [poolName: string]: Pool

Private Bucket

Bucket: Connection[]

The internal queue of Connections.