UNPKG

aliyun-tablestore-nodejs-sdk

Version:
35 lines (34 loc) 801 B
var client = require('./client'); var params = { tableMeta: { tableName: 'sampleTable', primaryKey: [ { name: 'gid', type: 'INTEGER' }, { name: 'uid', type: 'INTEGER' } ] }, reservedThroughput: { capacityUnit: { read: 0, write: 0 } }, tableOptions: { timeToLive: -1,// 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. maxVersions: 1// 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). } }; (async () => { try { const data = await client.createTable(params); console.log(data); } catch (error) { console.log(error); } })()