百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
W

workers-qb

> 编程语言
开源

用于 Cloudflare 工作者的零依赖查询构建器

398 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Cloudflare 工作者的零依赖查询构建器

Zero-dependency Query Builder for Cloudflare Workers

Overview

workers-qb is a lightweight query builder designed specifically for Cloudflare Workers. It provides a simple, standardized interface while maintaining the performance benefits of raw queries over traditional ORMs.

Read the full documentation

Key Differences from ORMs

  • Focused on direct SQL access with convenient wrapper methods
  • Maintains raw query performance
  • Zero dependencies
  • Lightweight and Worker-optimized

AI Skills

workers-qb provides AI coding assistant skills to help you write queries faster. Install them using npx skills:

bash
npx skills install G4brym/workers-qb

Available skills:

  • write-sql-queries - Comprehensive guide for writing SELECT, INSERT, UPDATE, DELETE queries

Supported Databases

  • ☁️ Cloudflare D1
  • Cloudflare Durable Objects
  • PostgreSQL (via node-postgres)
  • Bring Your Own Database

Features

Core Features

  • Zero dependencies
  • Full TypeScript support
  • Schema-aware type inference with autocomplete
  • Database schema migrations
  • Lazy row loading

Query Operations

  • Table operations (create/drop)
  • CRUD operations (insert/update/select/delete)
  • Bulk inserts
  • JOIN queries
  • Subqueries
  • Modular SELECT queries
  • ON CONFLICT handling
  • UPSERT support

Installation

bash
npm install workers-qb --save

Usage Examples

Cloudflare D1

…

Cloudflare Durable Objects

typescript
import { DOQB } from 'workers-qb'

type Schema = {
  employees: {
    id: number
    name: string
    role: string
  }
}

export class MyDurableObject extends DurableObject {
  #qb: DOQB

  constructor(ctx: DurableObjectState, env: Env) {
    super(ctx, env)
    this.#qb = new DOQB(ctx.storage.sql)
  }

  getEmployees() {
    // DOQB operations are synchronous - no await needed!
    return this.#qb
      .fetchAll({
        tableName: 'employees',  // ✓ Autocomplete
      })
      .execute()
      .results
  }
}

PostgreSQL Integration

First, install the required PostgreSQL client:

bash
npm install pg --save

Enable Node compatibility in wrangler.toml:

toml
node_compat = true

Example usage:

…

Documentation

Visit our comprehensive documentation for detailed information about:

  • Basic Queries
  • Advanced Queries
  • Migrations
  • Type Checking
  • Database-specific guides

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcloudflarecloudflare-d1cloudflare-workersd1sql

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言