讨论数量: 0
G02 Go API 实战
/
这节课来开发 『显示话题』接口。
我们希望返回的内容里附带 user 和 category 关联信息,需要修改下 topic.Get 方法。
打开 app/models/topic/topic_util.go 将 Get 方法修改如下:
func Get(idstr string) (topic Topic) {
database.DB.Preload(clause.Associations<...>
本文章首发在 LearnKu.com 网站上。
粤ICP备18099781号-6
|
粤公网安备 44030502004330号
|
违法和不良信息举报
由 Summer 设计和编码 ❤