Commit Graph

2 Commits

Author SHA1 Message Date
dfdc27c67f 修复:统一查询方法的返回顺序为索引递增
重要变更:
- QueryOldest 和 QueryNewest 现在都返回按索引递增排序的结果
- 移除了 QueryNewest 中的结果反转操作(line 184-187)

方法行为说明:
- QueryOldest(startIndex, count): 从 startIndex 向索引递增方向查询
- QueryNewest(endIndex, count): 从 endIndex 向索引递减方向查询
- 两者返回结果都按索引递增方向排序(一致性)

更新内容:
1. query.go:
   - 移除 QueryNewest 的反转操作
   - 更新两个方法的注释
2. topic_processor.go: 更新注释与实现一致
3. seqlog_test.go: 更新测试预期结果
4. example/index/main.go: 更新注释和输出说明

测试验证:
- 所有测试通过(go test ./... -short)
- 示例编译成功

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 11:55:44 +08:00
3d82a6845e 重构:将示例文件组织到子目录
修复 Go 规范问题:一个目录不能有多个 package main

文件结构调整:
- example/concurrent_example.go → example/concurrent/main.go
- example/index_example.go → example/index/main.go
- example/topic_processor_example.go → example/topic_processor/main.go

修复 API 适配:
- index/main.go: 更新为新的查询 API(移除 startIdx/endIdx 参数)
- webapp/main.go: 使用 processor.Query 方法替代 RecordQuery
  - 移除 queryCache,直接使用 processor
  - 更新查询调用,移除状态参数

文档更新:
- example/README.md: 更新所有示例的运行路径
- example/RUN_CONCURRENT.md: 更新运行命令

所有示例编译测试通过 
2025-10-04 01:27:56 +08:00