docs/core/gdb-chaining-relation-with #53
Replies: 6 comments 2 replies
-
相当于是作为 Join 的替代查询了,赞,建议在增加一下是否递归查询 With 的开关或者限制递归深度,毕竟如果子字段指定很多,将会发起很多次查询 |
Beta Was this translation helpful? Give feedback.
-
建议将案例中的gmeta.Meta改为g.Meta保持全局一致,否则看到有些地方是g.Meta有些地方是gmeta.Meta |
Beta Was this translation helpful? Give feedback.
-
dump出来的UserScores不应该是nil,应该是空数组‘[]’ |
Beta Was this translation helpful? Give feedback.
-
这种方式不适合不固定的order排序吧,比如UserDetail有age、city等字段,后端需要通过前端传的排序方式是age还是city来排序,需要获取User和UserDetail的列表 |
Beta Was this translation helpful? Give feedback.
-
type UserScores struct {
Id int `json:"id"`
Uid int `json:"uid"`
Score int `json:"score"`
}
type User struct {
Id int `json:"id"`
Name string `json:"name"`
} User和UserScores属于 |
Beta Was this translation helpful? Give feedback.
-
type User struct { 在1:n的场景下,我想限制n数量,比如上述中的 UserScores 我只想查出前10条,用with静态关联可以实现吗? |
Beta Was this translation helpful? Give feedback.
-
docs/core/gdb-chaining-relation-with
GoFrame框架中的With特性,通过示例展示了如何使用With特性实现模型关联、数据查询,介绍了数据结构定义、事务操作、数据写入与查询等方面的内容,帮助开发者更好地理解和使用GoFrame框架进行高效开发。
https://goframe.org/docs/core/gdb-chaining-relation-with
Beta Was this translation helpful? Give feedback.
All reactions