feat(lyra)!: 接入分类查询并集中组装依赖

- 使用 Squirrel 与 sqlx 实现分类查询
- 集中组装依赖并向 handler 注入 model 接口
- 显式转换分类响应 DTO,统一空列表输出
- 补充路由与 handler 测试,同步架构文档

BREAKING CHANGE: 将 GET /hello 替换为 GET /test,响应由问候字符串改为分类列表
This commit is contained in:
2026-10-17 17:06:20 +08:00
parent 8c0c9978e5
commit ab83ad96b4
16 changed files with 546 additions and 89 deletions
+8 -4
View File
@@ -1,11 +1,15 @@
package router
import (
"lyra/internal/handler"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(router *gin.Engine) {
router.GET("/hello", handler.Hello())
// Handlers 汇总各路由所需的处理器,由入口在启动时组装注入。
type Handlers struct {
TestHandler gin.HandlerFunc
}
// RegisterRoutes 将处理器挂载到引擎的路由表。
func RegisterRoutes(engine *gin.Engine, handlers Handlers) {
engine.GET("/test", handlers.TestHandler)
}