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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-edb

v1.0.6

Published

node.js database

Downloads

27

Readme

nodedb

node.js database 最简单的数据库, 免安装,只需插件引用,不需要学习 sql 语句 ,适用非大型项目,让 javascript 同学 从前端--后端--数据库 一把鲁下去。

一 安装方式

  npm install node-edb

二 初始化

  let path = require('path')

  let baseUrl = path.join(__dirname , '/data')

  let nodedb = require('node-edb')

  nodedb.init(baseUrl,'db')

1 init 第一个参数为 数据库数据保存的路径

2 init 第二个参数为 引用的数据库

3 数据库创建方式,非常简在存储路径下 新建一个文件夹即创建一个数据库 (比如 : /data/db)

4 创建表 以创建一个 user 表为列子

在对应的数据库文件夹下创建 user.json (/data/db/user.json) 填充内容:

{"autoId":0,"fields":{"id":"autoId","userName":"string","password":"string"}}

autoId : 参数为表自增 id 初始值 fields :参数为表中字段及字段的类型 类型支持 javascript 所有类型

注意点: user.json 为表结构 数据容器文件为 user.nb (此文件在 nodedb 第一次初始化的时候自动创建,也可以手动创建空文件)

三 使用说明 1 插入数据

   // insert data
   let result = nodedb.execute.insert('user',{userName:'yaguan2',password:'123425'})

2 查询数据 fields:查询过滤 where:查询条件 (支持正则) limit: 数据截取 sort:排序 paging: 支持分页

    // select data
    let result = nodedb.execute.select('user',{fields:['id','userName'],where:{userName:'yaguan',password:'RegExp(/2/)'},limit:[0,10],sort:-1,paging:{pageSize:2,page:0}})

3 更新数据

    // update data
    let result = nodedb.execute.update('user',{userName:'yaguan',password:'123425'},{where:{userName:'yaguan2'}})

4 删除数据

   // delete data
   let result = nodedb.execute.remove('user',{where:{userName:'yaguan2'}})