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

mysqlmid

v0.0.4

Published

mysqlmid ========

Readme

mysqlmid

node.js mysql middle

#Usage 一切都是为了方便地使用node.js操作mysql,根据日常经常使用的操作和各种坑,针对node.js的mysql模块进行二次封装,分享出来,希望你们喜欢。

#Quick Start

git clone https://github.com/youyudehexie/mysqlmid.git
npm install

#Public API

p.init(opt)

###连接参数 opt

  • host: 数据库地址
  • user: 数据库用户名
  • password: 数据库密码
  • database: 使用的数据库
  • 更多参数:https://github.com/felixge/node-mysql

p.Schema(name, table)

  • 数据表实例化对象的名字
  • 数据表名称

Schema

var User = Schema('User', 'weibo_tag');

findOne(where, cb)

根据查找条件,找出一个匹配的一个值,实际执行的时候利用limit(1)来实现

var where = {
	tag_status: 0
}

User.findOne(where, function(err, result){
	console.log(err, result); //查找结果为空时,返回null,查找成功时,直接返回result[0]的结果,不需要再次处理
});

find(where, cb)

查找所有匹配条件的值

var where = {
	tag_status: 0
}

User.findOne(where, function(err, result){
	console.log(err, result); //查找结果为空时,返回null
});

update(where, update, cb)

var where = {
	id: 123124
}

var update = {
	tag_status: 1
}

User.update(where, update, function(err){
	console.log(err);
});

insert(insert, cb)

var insert = {
	name: 'youyudehexie'
}

User.insert(insert, function(err, insertid){
	console.log(err, insertid);  //成功插入后,返回对应的插入ID。
});

delete(where, cb)

var where = {
	name: 'youyudehexie'
}

User.insert(where, function(err){
	console.log(err); 
});

还有更强大的功能,整理

#Example

var mysqlmid = require('../lib');
var Schema = mysqlmid.Schema;

var opt = {
	host: '127.0.0.1',
	user: 'root',
	password: '123456',
	database: 'weibo'
}

mysqlmid.init(opt);

var User = Schema('User', 'weibo_tag');

var where = {
	tag_status: 0
}

User.findOne(where, function(err, result){
	console.log(err, result);
})