npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

light-api-mysql

v1.0.12

Published

the plgin of the light-api server for mysql service

Readme

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"}],//(必须)不同mysql服务器的host
  "port"               :  3306, // (必须)端口
  "user"               :  "username",// (必须) 用户名
  "password"           :  "xxxxx",//(必须)密码
  "database"           :  "test",//(必须)需要连接的数据库名
  "charset"            :  "UTF8_GENERAL_CI", // (可选)编码 ,默认:'UTF8_GENRAL_CI' 
  "timezone"           :  "local",//(可选) 时区,默认:'loacl'
  "connectTimeout"     :   10000 ,//(可选) 连接超时时间,默认10000毫秒
  "localAddress"       :   "xxxx",// (可选) 使用TCP连接时的IP地址
  "socketPath"         :   "xxxx",// (可选) unix域套接字路径,使用这个选项会忽略host和port选项
  "ssl"                :   {"ca" : "crt内容"}, //(可选) 使用ssl连接
  "waitForConnections" :   true, //(可选) 没有连接或达到最大连接时连接的形为。为true时,连接池会将连接排队以等待可用连接。为false将立即抛出错误(默认:true)
  "connectionLimit"    :   10, //(可选) 每个server单次可创建最大连接数(默认:10)
  "queueLimit"         :   0, //(可选) 连接池的最大请求数,从getConnection方法前依次排队。设置为0将没有限制(默认:0)
  "clusterOption"      :   {
      "canRetry"                :  true,//(可选) 当为true时,PoolCluster会在连接失败时尝试重连(默认:true)
      "removeNodeErrorCount"    : 5, //(可选) 连接失败时Node的errorCount计数会增加。当累积到这个值时移除PoolCluster这个节点(默认:5)
      "restoreNodeTimeout"      : 0, //(可选) 连接失败后重试连接的毫移数(默认:0)
      "defaultSelector"         : "RR" //(可选) 选择集群中server的策略(默认:RR)(RR-依次选择,RANDOM-随机选择,ORDER-选择第一个可用节点)
     }
}

单机模式配置

{
  "host"               :  "localhost",//(必须)不同mysql服务器的host
  "port"               :  3306, // (必须)端口
  "user"               :  "username",// (必须) 用户名
  "password"           :  "xxxxx",//(必须)密码
  "database"           :  "test",//(必须)需要连接的数据库名
  "charset"            :  "UTF8_GENERAL_CI", // (可选)编码 ,默认:'UTF8_GENRAL_CI' 
  "timezone"           :  "local",//(可选) 时区,默认:'loacl'
  "connectTimeout"     :   10000 ,//(可选) 连接超时时间,默认10000毫秒
  "localAddress"       :   "xxxx",// (可选) 使用TCP连接时的IP地址
  "socketPath"         :   "xxxx",// (可选) unix域套接字路径,使用这个选项会忽略host和port选项
  "ssl"                :   {"ca" : "crt内容"}, //(可选) 使用ssl连接
  "waitForConnections" :   true, //(可选) 没有连接或达到最大连接时连接的形为。为true时,连接池会将连接排队以等待可用连接。为false将立即抛出错误(默认:true)
  "connectionLimit"    :   10, //(可选) 每个server单次可创建最大连接数(默认:10)
  "queueLimit"         :   0 //(可选) 连接池的最大请求数,从getConnection方法前依次排队。设置为0将没有限制(默认:0)

}

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. 解决长时间不使用数据库,数据库连接断开报错