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

hnz-mysql

v1.0.6

Published

用于mysql开发的链式调用包。

Downloads

50

Readme

hnz-mysql

用于mysql开发的链式调用包。

安装

npm install hnz-mysql

使用

引入

var hnzMysql = require("hnz-mysql");

构造函数

var m = new hnzMysql({
	host:'localhost',
	user:'root',
	password:"",
	database:"book2-6"
})

| 参数 |必填| 描述 | |--------|-------|---------------------| | host | 是 |数据库主机 | | user | 是 | 数据库用户名 | | password | 是 | 数据库密码 | | port | 可选 | 数据库端口号,默认3306 | | database | 是 | 数据库名称 |

常用方法

| 方法 | 描述 | |--------|-----------------| | t(table) | 设置要操作表名称 | | f(field) | 设置查询字段名称 | | data(data) | 设置数据,格式为 {} | | o(order,type) | 按照某个字段排序 | | l(offset,num) | 截取数据 | | w(data) | where条件,格式为 {} | | s(callback) | 查找数据 | | u(callback) | 更新某个字段数据 | | i(callback) | 更新某个字段数据 | | d(callback) | 删除条数据 | | query() | 执行query操作(同mysql包,query用法) |

查询操作

// m.t('users') 设置表为users表
m.t('users').s(function(err,result){
 	console.log(err)
 	console.log(result)
})

// m.f('name,age,sex') 设置查询字段
m.t('users').f('name,age,sex').s(function(err,result){
 	console.log(err)
 	console.log(result)
})

更新操作

// m.data({description:"生活最终不会亏待任何人"}) 设置要操作数据
m.t("article")
.data({description:"生活最终不会亏待任何人"})
.w({id:1})
.u(function(err,result){
	console.log(err)
	console.log(result);
})

插入操作

m.t("users").data({username:'baihe', password:123456, nickname:'百合'}).i(function(err,result){
	console.log(err)
	console.log(result);
})

删除操作

// m.w({iuid:4})  设置查询条件
m.t("users").w({iuid:4}).d(function(err,result){
	console.log(result)
})