light-api-mysql

1.0.12 • Public • Published

light-api-mysql

2019-12-12 发布1.0.12版本

1.增加集群连接断后重连

2019-12-12 发布1.0.11版本

1.增加mysql的集群模式连接

2.升级mysql的单机模式连接

集群模式配置

 
{
  "cluster"            :  [{"host":"server1"},{"host":"sever2"},{"host":"server3"}],//mysqlhost
  "port"               :  3306, // 
  "user"               :  "username",//  
  "password"           :  "xxxxx",//
  "database"           :  "test",//
  "charset"            :  "UTF8_GENERAL_CI", //  'UTF8_GENRAL_CI' 
  "timezone"           :  "local",//() 'loacl'
  "connectTimeout"     :   10000 ,//() 10000
  "localAddress"       :   "xxxx",// () 使TCPIP
  "socketPath"         :   "xxxx",// () unix使hostport
  "ssl"                :   {"ca" : "crt内容"}, //() 使ssl
  "waitForConnections" :   true, //() truefalsetrue
  "connectionLimit"    :   10, //() server10
  "queueLimit"         :   0, //() getConnection00
  "clusterOption"      :   {
      "canRetry"                :  true,//() truePoolClustertrue
      "removeNodeErrorCount"    : 5, //() NodeerrorCountPoolCluster5
      "restoreNodeTimeout"      : 0, //() 0
      "defaultSelector"         : "RR" //() serverRRRRRANDOMORDER
     }
}
 
 

单机模式配置

{
  "host"               :  "localhost",//mysqlhost
  "port"               :  3306, // 
  "user"               :  "username",//  
  "password"           :  "xxxxx",//
  "database"           :  "test",//
  "charset"            :  "UTF8_GENERAL_CI", //  'UTF8_GENRAL_CI' 
  "timezone"           :  "local",//() 'loacl'
  "connectTimeout"     :   10000 ,//() 10000
  "localAddress"       :   "xxxx",// () 使TCPIP
  "socketPath"         :   "xxxx",// () unix使hostport
  "ssl"                :   {"ca" : "crt内容"}, //() 使ssl
  "waitForConnections" :   true, //() truefalsetrue
  "connectionLimit"    :   10, //() server10
  "queueLimit"         :   0 //() getConnection00
 
}
 

2019-4-29 发布1.0.10版本

1.增加转移函数

rdb.escape(param);

2018-4-23 发布1.0.9版本

1.修改数据库的update语句,兼容mysql关键(schema)字不能更新的问题

2018-3-5 发布1.0.8版本

1.增加数据库连接配置的端口配置(port)和字符集配置(charset)

       host     : option.host (Default: 'localhost'),
       port     : option.port (Default: 3306),
       user     : option.user (Default: root),
       password : option.password (Default: ''),
       database : option.database (Default: 'test'),
       charset  : option.charset(Default: 'UTF8_GENERAL_CI')

2017-12-13 发布1.0.7版本

1.修复mysql链接池中取出连接使用时链接已关闭的问题

2017-12-12 发布1.0.6版本

1.修复mysql链接池不能回收连接的问题

2017-12-11 发布1.0.5版本

1.解决分页查询,查询参数数组传入失效的问题。


  rdb.query(`SELECT * FROM book WHERE  show_name like ?  and app_describe like ? `,'%d%','%4%')
         .then(function(result){
             return reply.data(result);  
         });

  也可写成下面的数组参数形式:

  rdb.query(`SELECT * FROM book WHERE  show_name like ?  and app_describe like ? `,['%d%','%4%'])
         .then(function(result){
             return reply.data(result);  
         });

2017-11-13 发布1.0.4版本

  1. 解决长时间不使用数据库,数据库连接断开报错

Readme

Keywords

none

Package Sidebar

Install

npm i light-api-mysql

Weekly Downloads

14

Version

1.0.12

License

ISC

Unpacked Size

21.4 kB

Total Files

4

Last publish

Collaborators

  • tonyonlian