我使用 MapScan 并使用此错误对其进行迭代
无法解组为非指针 int64
第一次迭代后出错。
这是我正在处理的代码:
type NotFinishedTBLFields struct {
Bulk_id int64
Recipient string
Operator string
Tracking_code string
}
func FetchNotFinishedTBLRows() *NotFinishedTBLFields {
rowValues := make(map[string]interface{})
var row NotFinishedTBLFields
iter := Instance().Query(fmt.Sprintf(`SELECT * FROM %q `, NotFinishedTBLConfig.Name)).Consistency(gocql.All).Iter()
for iter.MapScan(rowValues) {
fmt.Println("rowValues ",rowValues)
row = NotFinishedTBLFields{
Bulk_id: rowValues["bulk_id"].(int64),
Recipient: rowValues["recipient"].(string),
Operator: rowValues["operator"].(string),
Tracking_code: rowValues["tracking_code"].(string),
}
}
if err := iter.Close(); err != nil {
log.Fatal(err)
}
return &row
}