aliyun / aliyun-tablestore-nodejs-sdk

Aliyun TableStore(原OTS) SDK for Node.js
Apache License 2.0
88 stars 33 forks source link

Support Transaction #22

Closed acathur closed 5 years ago

acathur commented 5 years ago

Add ['startLocalTransaction', 'commitTransaction', 'abortTransaction'] to client.

Usage:

// start transaction
const transaction = await client.startLocalTransaction({
    tableName: 'sample',
    primaryKey: [{
        "id": "a6ef32e3-e058-4b71-b39b-16ad2f6b1afb"
    }]
})
const transactionId = transaction.transactionId

// commit
await client.commitTransaction({
    transactionId
})

// or abort
await client.commitTransaction({
    transactionId
})

Reference: https://help.aliyun.com/document_detail/93819.html

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.