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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wx-cloud-db-falsework

v1.3.3

Published

a falsework for weixin miniProgram cloud database

Readme

# wx-cloud-db-falsework

a falsework for weixin miniProgram cloud database
微信小程序云开发数据库脚手架

  # Install

npm install wx-cloud-db-falsework

  # Quick Start

import { DB, Model } from 'path/wx-cloud-db-falsework.min'

class Order extends Model {
  constructor(o) {
    let t = super(o)
    return t
  }
}

// collectionName 默认为model名,如Order默认为order
// collectionKey  默认_id
// cloud 小程序端传 wx.cloud, 云函数端传require('wx-server-sdk')
const Odr = Order.init({ env: '环境ID', cloud, [, collectionName = '集合名称', collectionKey = '主键字段名'] })

let row = await Odr.doc('xxxx').get()
let row = await Odr.find('xxxx')
let row = await Odr.where({_id: 'xxxx'}).get()
let row = await Odr.find(`{_id: this._.eq('xxxx')}`)
let row = await Odr.find({_id: Odr._.eq('xxxx')})

if(row instanceof DB.DbError){

	console.log('error', row)

}else if(row instanceof DB.DbRes){

	console.log('execed sql ==> ', row.sql)

	if(row instanceof DB.DbResultJson){

		console.log('DbResultJson ==> ', row)

	}else {

		// row instanceof DB.DbResultArray
		console.log('DbResultArray ==> ', row)

	}

	// update
	let back = await row.update({
		abc: 888
	}) ==> // { updated:Number }

	// remove
	let back = await row.remove() ==> // { removed:Number }
}

Other Demo

await Odr.add({_id: 'xxxx', abc: 123})

await Odr.add(`{_id: 'xxxx'}`)

await Odr.add({ data:{_id: 'xxxx'}, success(res){}, fail(res){}, complete(res){} })

await Odr.update({abc: 456}, {_id: 'xxxx'})

await Odr.where({_id: 'xxxx'}).update({abc: 456})

await Odr.doc('xxxx').update({abc: 456})

await Odr.doc('xxxx').update({ data: {abc: 456}, success(res){}, fail(res){}, complete(res){} })

await Odr.aggregate().match({abc: 456}).end()

await Odr.doc('xxxx').remove()

await Odr.where({_id: 'xxxx'}).remove()

await Odr.remove({_id: 'xxxx'})

await Odr.remove({ where: {_id: 'xxxx'}, success(res){}, fail(res){}, complete(res){} })

await Odr.remove(`{_id: 'xxxx', abc: this._.eq(456)}`)

await Odr.remove({_id: 'xxxx', abc: Odr_.eq(456)})