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

zbh-sqlite

v1.0.1

Published

基于uniapp对sqlite的api支持进行封装,增删改通用化,快速上手

Downloads

7

Readme

zbh-sqlite 1.0.1

工欲善其事必先利其器 ###实现思路:uni-app支持sqlite,使用的是 HTML5+ API Reference ###方法: openDatabase: 打开数据库 isOpenDatabase: 判断数据库是否打开 closeDatabase: 关闭数据库 transaction: 执行事务 executeSql: 执行增删改等操作的SQL语句 selectSql: 执行查询的SQL语句 ###回调方法: SQLiteSuccessCallback: SQLite操作成功回调函数 SQLiteFailCallback: SQLite操作失败回调函数 ###原生Android开发都知道操作数据库的流程是: 打开数据库 -> 开启事务 -> 执行SQL/查询SQL(查询可不用事务) -> 关闭事务 -> 关闭数据库 ###封装原理: ####核心保留执行SQL/查询SQL, 将数据库打开/关闭、事务开启/关闭封装; ####在此基础上封装增删改为通用方法,只需要传表名、列名、列值; ####查询暂未封装, 业务不一样要查询的数据也不一样(后续可能会封装一些通用的查询方法) ####!!!创建表方法未封装,表的管理、创建表方法示例 在dbtable-manage.js里,操作前先把表建好(后续优化,以及表列的增删改操作) ####!!!建议: 当前版本的数据库操作肯定是不足的,对每张表建议管理在一起,例如在根目录/插件目录下建一个db目录,然后建要用的表文件(用户表user.js, 城市表city.js...)

使用:

1、App.vue 相关配置

import sqlite from '@/uni_modules/zbh-sqlite/components/zbh-sqlite/index.js'
import table from '@/uni_modules/zbh-sqlite/components/zbh-sqlite/dbtable-manage.js'
onLaunch: function() {
	// 修改数据库名称
	sqlite.dbName = 'xxx';
	// 修改数据库路径
	sqlite.dbPath = '_doc/xxx.db';
	// 初始化数据表(暂未拥有更改表字段功能)
	table.init();
},

2、新建表: 查看dbtable-manage.js 后续页面传值要对应好表列名,参考快速开始data的user与dbtable-manage.js的user

安装方式

1、DCloud 插件市场 通过 HBuilder 导入插件包或配置 manifest.json

2、npm 安装

npm install [email protected]

快速开始

import sqlite from '@/uni_modules/zbh-sqlite/components/zbh-sqlite/index.js'
import table from '@/uni_modules/zbh-sqlite/components/zbh-sqlite/dbtable-manage.js'

export default {
	data() {
		user: {
			// 表字段: 字段值
			username: 'admin',
			password: '123'
		}
	},
	methods: {
		// 查询所有
		selectAll(){
			sqlite.selectAll(table.name.USER).then(res => {
				...
			}).catch(e =>){
				...
			}
		},
		// 新增
		insert(){
			sqlite.add(table.name.USER, this.user).then(res => {
				...
			}).catch(e =>){
				...
			}
		}
	}
}