【发布时间】:2017-01-30 07:45:54
【问题描述】:
Aerospike Go 客户端
问题
需要为所有集合添加一组公共字段,即 CreatedAt、UpdtedAt、DeletedAt 等。同样,我创建了一个结构并将其嵌入到所有集合结构中。我需要将公共结构的字段保存在集合中作为给定记录的字段
示例代码
type Table struct {
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt time.Time
}
type Account struct {
Table
Name string
Status bool
.....
}
对于上面提到的结构Account。我希望记录存储与bin名称
CreatedAt,UpdatedAt,DeletedAt,Name,Status.....
但是当记录存储时bin名称是
Table,Name,Status...
Table 是带有键值的映射
是否有可能实现预期的行为?如果有怎么办?
【问题讨论】:
标签: database go marshalling aerospike nosql