
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
jbdap-sqlite
Advanced tools
JBDAP-Node-Sqlite 是 JBDAP 在 nodejs 环境下针对 Sqlite 数据库的官方实现,使用它可以快速开发一个基于 Sqlite 的数据库应用(可以是 Native 或者 B/S 或者 C/S 架构),操作数据的后端代码量可以减少 80% 以上。
如果您的项目采用了其它数据库,我们也有相应的实现可供使用:
也欢迎您编写更多其它数据库的 JBDAP 实现贡献给社区。
注:支持 nodejs 8 及更高版本
npm i jbdap-sqlite --save
// 或者
yarn add jbdap-sqlite
注意,因为包内自带了 sqlite3 引擎,所以无需单独安装
我们假定在项目根目录下有一个叫做 /database/data.sqlite 的数据库,里面有个 [User] 表已经填充了一些数据
// 引用
const JBDAP = require('jbdap-sqlite')
// Sqlite 数据库文件
const path = require('path')
const dbFile = path.join(process.cwd(), 'database', 'data.sqlite')
// 创建连接
const conn = JBDAP.getConn(dbFile)
// 参数配置
let config = {
language: 'zh-cn', // 以简体中文作为交流语言
printSql: true, // 是否打印 sql 语句(方便调试,生产环境可关闭)
}
// JBDAP指令描述(取出全部用户列表)
let json = {
commands: [
{
name: 'allUsers',
type: 'list',
target: 'User',
}
]
}
// 执行查询
JBDAP.manipulate(conn,json,config)
.then((res)=>{
console.log(JSON.stringify(res,null,4))
})
.catch((err)=>{
console.log(err)
})
// 打印出的返回结果如下
{
"code": 200,
"message": "ok",
"data": {
"allUsers": [
{
"id": 1,
"username": "user1",
"password": "password1",
"avatar": null,
"email": null,
"gender": "FEMALE",
"createdAt": "2020-07-08 14:42:44",
"updatedAt": "2020-07-08 14:42:44"
},
...
]
}
}
很简单吧,我们只需要改变 json 的内容,就可以使用上述代码进行 JBDAP 规范下的任何数据库查询或者操作。
由于 JBDAP-Node-Sqlite 是对 JBDAP 协议的实现,因此它的能力其实也就是 JBDAP 的能力,在查看实例代码之前,我们先看一下 JBDAP 的能力全景图:
说实话,如果你能看完前面的实例代码手册,那么已经可以满足正常开发需要了。以下 API 可以帮助你更好的理解 JBDAP 实现的逻辑结构,对于想要开发自己 JBDAP 引擎的朋友来说会比较有用。先了解大体结构之后再去看源码效率会更高一些。
以上就是全部的 API 了。
FAQs
The official JBDAP implementation for nodejs work with sqlite.
The npm package jbdap-sqlite receives a total of 2 weekly downloads. As such, jbdap-sqlite popularity was classified as not popular.
We found that jbdap-sqlite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.