aliyun-tablestore-go-sdk icon indicating copy to clipboard operation
aliyun-tablestore-go-sdk copied to clipboard

批量写入时设置了SetReturnPk并没有返回主键

Open lhlyu opened this issue 4 years ago • 0 comments
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)

lhlyu avatar Oct 17 '21 02:10 lhlyu