我在 aerospike 中有相当复杂的模式:-
DATA SCHEMA:
bin name: user_ids
Type: List of Strings
bin name: user_w
Type: List of Integers
bin name: users
Type: map<String<List>> where list is again list(size 3) of lists each of type String
我能够使用以下数据结构将此模式直接读入 Java 对象:-
userIds = (List<String>) r.getList("user_ids");
userWeights = (List<String>) r.getList("user_w");
users = (Map<String, List>) r.getValue("users");
但是我的以下 go struct 无法检索它。它的到来是空的。结构模式有问题吗?
type AudienceRecord struct {
user_ids []string
user_w []int64
users map[string][][]string
}
最佳答案
您的 user_w 架构是整数列表还是字符串列表? 因为你的 java 和 go 模式在这里不等同。 这就是 Go struct 无法解析您的 aerospike 数据的原因。
关于go - 如何在 Go 中反序列化 Aerospike 记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39510413/