重构代码结构并添加完整功能

主要改动:
- 重构目录结构:合并子目录到根目录,简化项目结构
- 添加完整的查询 API:支持复杂条件查询、字段选择、游标模式
- 实现 LSM-Tree Compaction:7层结构、Score-based策略、后台异步合并
- 添加 Web UI:基于 Lit 的现代化管理界面,支持数据浏览和 Manifest 查看
- 完善文档:添加 README.md 和 examples/webui/README.md

新增功能:
- Query Builder:链式查询 API,支持 Eq/Lt/Gt/In/Between/Contains 等操作符
- Web UI 组件:srdb-app、srdb-table-list、srdb-data-view、srdb-manifest-view 等
- 列选择持久化:自动保存到 localStorage
- 刷新按钮:一键刷新当前视图
- 主题切换:深色/浅色主题支持

代码优化:
- 使用 Go 1.24 新特性:range 7、min()、maps.Copy()、slices.Sort()
- 统一组件命名:所有 Web Components 使用 srdb-* 前缀
- CSS 优化:提取共享样式,减少重复代码
- 清理遗留代码:删除未使用的方法和样式
This commit is contained in:
2025-10-08 16:42:31 +08:00
parent ae87c38776
commit 23843493b8
64 changed files with 8374 additions and 6396 deletions

View File

@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -11,59 +11,15 @@
rel="stylesheet"
/>
<link rel="stylesheet" href="/static/css/styles.css" />
<script src="https://npm.onmicrosoft.cn/htmx.org@2.0.7/dist/htmx.min.js"></script>
</head>
<body>
<div class="container">
<!-- 左侧表列表 -->
<div class="sidebar" id="sidebar">
<h1>Tables</h1>
<div
id="table-list"
hx-get="/api/tables-html"
hx-trigger="load"
>
Loading tables...
</div>
</div>
<!-- 右侧主内容区 -->
<div class="main" id="main-content">
<div class="empty">
<h2>Select a table to view data</h2>
<p>Choose a table from the sidebar to get started</p>
</div>
</div>
</div>
<!-- 应用容器 -->
<srdb-app></srdb-app>
<!-- Modal -->
<div id="modal" class="modal" style="display: none">
<div class="modal-content">
<div class="modal-header">
<h3 id="modal-title">Content</h3>
<button class="modal-close" onclick="closeModal()">
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<pre id="modal-body-content"></pre>
</div>
</div>
</div>
<srdb-modal-dialog></srdb-modal-dialog>
<script src="/static/js/app.js"></script>
<!-- 加载 Lit 组件 -->
<script type="module" src="/static/js/app.js"></script>
</body>
</html>