npm.io
0.0.5 • Published 1 year ago

pomelo-mysql-data-plugin

Licence
—
Version
0.0.5
Deps
2
Size
8 kB
Vulns
0
Weekly
0

pomelo-mysql-data-plugin

forked from pomelo-data-plugin

using mysql as a data source

Config data plugin for Pomelo(a fast,scalable,distributed game server framework for Node.js. http://pomelo.netease.com), it can be used in Pomelo(>=0.7.0).

##Installation

npm install pomelo-mysql-data-plugin

##Usage

var dataPlugin = require('pomelo-mysql-data-plugin');
var mysqlConfig = {
  "dialect": "mysql",
  "host": "127.0.0.1",
  "port": "3306",
  "database": "test",
  "username": "test",
  "password": "test"
};
... ...
app.use(mysqlDataPlugin, {
    watcher: {
      idx: 'id',
      interval: 60000,
      dbConfig: mysqlConfig,
      tables: ['npc_config', 'task_config']
    }
  });
... ...
... ...
var npcConf = app.get('mysqlDataService').get('npc_config');
... ...
... ...