aliyun-tablestore-go-sdk
aliyun-tablestore-go-sdk copied to clipboard
批量写入时设置了SetReturnPk并没有返回主键
trafficstars
- go版本:
1.17 - sdk版本:
v5.0.6 - 代码如下
batchWriteReq := &tablestore.BatchWriteRowRequest{}
for _, data := range datas {
putRowChange := new(tablestore.PutRowChange)
putRowChange.TableName = table_im_user_pool
putPk := new(tablestore.PrimaryKey)
putPk.AddPrimaryKeyColumn("pk1", "xxxx")
putPk.AddPrimaryKeyColumnWithAutoIncrement("pk2")
putRowChange.PrimaryKey = putPk
putRowChange.AddColumn("col", "xxxxx")
putRowChange.SetCondition(tablestore.RowExistenceExpectation_IGNORE)
// 这里设置了
putRowChange.SetReturnPk()
batchWriteReq.AddRowChange(putRowChange)
}
// resp内并没有返回主键
resp, err := client.BatchWriteRow(batchWriteReq)