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

@yuliqi/node-red-contrib-qdb

v0.0.6

Published

A knex node for Node-RED

Readme

node-red-contrib-qdb

基于 Knex 的 Node-RED 自定义数据库节点,支持几乎所有主流数据库,简化初始化配置,安全管理数据库密码,支持复用。

简介

node-red-contrib-qdb 是一个 Node-RED 节点,用于方便地在流程中使用 Knex 进行数据库操作。相比直接使用 Knex,这个节点有以下优势:

  • 支持几乎所有主流数据库:MySQL、PostgreSQL、SQLite、MSSQL、Oracle 等。
  • 无需繁琐初始化:自动管理 Knex 实例,避免重复创建。
  • 节点复用:同一配置可被多个节点共享,方便统一管理。
  • 安全:数据库密码自动加密存储,保护敏感信息。
  • 健康检查:实时监控数据库连接状态,节点状态可视化。
  • 完全支持 Knex 语法:可以在后续函数节点中直接使用 Knex 查询。

当前版本为预览版,仅支持中文,后续可能增加多语言支持。

安装

npm install node-red-contrib-qdb

在 Node-RED 中安装后,节点分类为 Storage

节点使用

QDB 节点

QDB 节点用于在流程中输出 Knex 实例,输出到 msg.qdb 或自定义字段。

配置参数

| 参数 | 描述 | | ---- | ------------------------- | | 名称 | 节点名称,可选 | | 链接 | 选择数据库配置节点 | | 输出字段 | 输出 Knex 实例的消息字段,默认为 qdb |

示例

在流程中:

  1. 添加一个 QDB 节点并选择数据库配置。
  2. 输出字段默认为 msg.qdb,后续节点中可直接调用:
const { qdb } = msg;

const result = await qdb
    .select('*')
    .from('users')
    .limit(10);
msg.payload = result;

return msg;

数据库配置节点(qdb-config)

  • 配置数据库类型、连接信息、用户名、密码等。
  • 密码会自动加密存储,无需担心泄露。
  • 可被多个 QDB 节点复用,实现统一管理。

特性亮点

  1. Knex 全功能支持:无需限制查询语法,完全兼容 Knex 文档。
  2. 多节点复用:同一配置节点可被多个 QDB 节点共享实例,自动缓存管理。
  3. 连接健康监控:节点状态实时显示数据库连接状态,绿色为正常,红色为断开。
  4. 预览版:目前仅支持中文,未来将支持多语言。

文档与帮助

节点内置帮助文档可查看使用说明和示例,也可以导入官方提供的 Node-RED 流程示例进行测试和学习。

示例导入

  1. 下载示例 JSON 文件。
  2. 在 Node-RED 中点击菜单 -> 导入 -> 粘贴 JSON -> 导入到画布。
  3. 直接运行示例流程,即可体验 QDB 节点功能。

注意事项

  • 仅支持 Node-RED v4 及以上版本。
  • 预览版仍在迭代中,后续将优化多语言、异常处理等功能。
  • 所有数据库密码已加密存储,但建议在生产环境仍使用安全通道访问数据库。

贡献

欢迎提交 issue 或 PR,一起完善 QDB 节点生态。

License

MIT