- 使用 Squirrel 与 sqlx 实现分类查询 - 集中组装依赖并向 handler 注入 model 接口 - 显式转换分类响应 DTO,统一空列表输出 - 补充路由与 handler 测试,同步架构文档 BREAKING CHANGE: 将 GET /hello 替换为 GET /test,响应由问候字符串改为分类列表
10 lines
242 B
Go
10 lines
242 B
Go
package api
|
|
|
|
// CategoryResponse 分类列表响应 DTO,字段名显式约定小写 JSON 键。
|
|
type CategoryResponse struct {
|
|
ID int64 `json:"id"`
|
|
Slug string `json:"slug"`
|
|
Title string `json:"title"`
|
|
Sort int `json:"sort"`
|
|
}
|