【发布时间】:2020-11-22 02:14:55
【问题描述】:
我正在从 redis.HGetAll 获取数据,但找不到将结果转换为我的结构的干净方法
var object struct {
x int
}
result := redisClient.HGetAll(context.Background(), "the_h_key")
//TODO import the result content into the object
这个壮观的案例有什么功能吗?
现在我使用 json 包(marshal,然后 UnMarshal 到 struct"。
【问题讨论】: