@ppzp/bd
一个用于简化VSCode插件开发中数据持久化操作的JavaScript库,提供集合实例创建、数据增删改查等便捷功能。
• Copy the embed code to showcase this product on your website
• Share on X to spread the word about this amazing tool
地址:https://github.com/ppz-pro/bd.vscode### Collection 实例创建 user collection: jsconst Collection = require('@ppzp/bd/collection')const userCollection = new Collection('user')### 新增数据创建用户: jsawait userCollection.insertOne({ name: 'ppz', year: 3})### 查找数据获取用户,返回一个数组: jsconst users = userCollection.getAll()### 查找数据按 id 获取用户,返回一个用户: jsconst user = userCollection.findById(userId)### 更新数据更新用户,整体替换,非局部更新: jsconst user = userCollection.findById(userId)user.name = 'ccz'user.year = 2await userCollection.replaceOne(user)### 删除数据删除用户: jsawait userCollection.deleteById(userId)更多具体细节请参考这个 demo