你为什么还在使用 AI 生成表格代码? 😤

发布: (2026年2月20日 GMT+8 02:22)
2 分钟阅读
原文: Dev.to

Source: Dev.to

Introduction

每次我让 ChatGPT 创建数据表时,都会得到相同的 200 多行代码:过滤、排序、分页、搜索、导出、列可见性、日期选择器……
新项目?同样的提示。相同的代码。相同的调试。

我意识到自己在为永远不会改变的工作付费。AI 适合解决创造性问题,但重复的模板代码应该被抽象化。

于是我构建了 TableCraft —— 一个基于 Drizzle ORM 的表格引擎,能够根据数据库模式自动生成所有内容。

Example

import { Hono } from 'hono';
import { createHonoApp } from '@tablecraft/adapter-hono';
import { defineTable } from '@tablecraft/engine';
import { db } from './db';
import * as schema from './db/schema';

const users = defineTable(schema.users)
  .hide('password')
  .search('email', 'name')
  .sort('-createdAt');

const app = createHonoApp({
  db,
  schema,
  configs: { users },
});

new Hono().route('/api/engine', app);
import { DataTable, createTableCraftAdapter } from '@tablecraft/table';

const adapter = createTableCraftAdapter({
  baseUrl: '/api/engine',
  table: 'users',
});

export function UsersPage() {
  return ;
}

一个组件。无需列定义。

Features

  • ✅ 从模式自动生成列
  • ✅ 服务端过滤、排序、分页
  • ✅ 全局搜索
  • ✅ 日期范围选择器
  • ✅ CSV/Excel 导出
  • ✅ 列可见性与大小调整
  • ✅ URL 状态同步(可分享链接)
  • ✅ 基于角色的访问控制
  • ✅ 软删除支持
  • ✅ TypeScript 类型生成

Packages

PackageDescription
@tablecraft/engine后端查询引擎
@tablecraft/tableReact 数据表格组件
@tablecraft/adapter-honoHono 适配器
@tablecraft/adapter-expressExpress 适配器
@tablecraft/adapter-nextNext.js 适配器
@tablecraft/adapter-elysiaElysia (Bun) 适配器
  • GitHub:
  • Documentation:
0 浏览
Back to Blog

相关文章

阅读更多 »

Apex B. OpenClaw,局部嵌入

本地嵌入用于私有记忆搜索。默认情况下,OpenClaw 的 memory search 会将文本发送到外部的 embedding API,通常是 Anthropic 或 OpenAI……

Apex 1. OpenClaw, 供应商历史

从 ChatGPT、Anthropic 和 Google Gemini 导入聊天记录。使用 OpenClaw,你可以做的最强大的事情之一是 bootstrap 你的记忆……