我在设计代码体系结构时遇到一些问题...我正在使用SQL存储在Golang上编写Web应用程序。我有两个实体:用户,位置。
type User struct {
id uint64
....
locationID uint64
....
valueA uint
lastValueAUpdateTimestamp time.Time
}
type Location struct {
id uint
....
}
在实体“用户”中,我具有随时间更新的动态参数(valueA)。更新valueA取决于lastValueAUpdateTimestamp和用户位置参数。
根据用户locationID将位置对象传递给用户的最佳方法是什么?我有几种选择: