https://github.com/coajs/coa-ali-ots
轻量的阿里云TableStore封装 for Node.js
https://github.com/coajs/coa-ali-ots
ali ali-ots coa coa-ali-ots coajs ots
Last synced: about 2 months ago
JSON representation
轻量的阿里云TableStore封装 for Node.js
- Host: GitHub
- URL: https://github.com/coajs/coa-ali-ots
- Owner: coajs
- License: mit
- Created: 2021-04-23T09:36:05.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-15T22:03:28.000Z (almost 2 years ago)
- Last Synced: 2025-03-30T13:03:46.086Z (2 months ago)
- Topics: ali, ali-ots, coa, coa-ali-ots, coajs, ots
- Language: TypeScript
- Homepage: https://npmjs.com/coa-ali-ots
- Size: 142 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# coa-ali-ots
[](LICENSE)
[](https://www.npmjs.org/package/coa-ali-ots)
[](http://npm-stat.com/charts.html?package=coa-ali-ots)
[](https://github.com/coajs/coa-ali-ots/pulls)轻量的阿里云 TableStore 封装 for Node.js。基于 [tablestore](https://www.npmjs.com/package/tablestore) 做简单处理。
根据日常实际项目使用情况,封装了一些个人常用的的方法。此方法在特殊场景下使用,不具有普遍性。
## 快速开始
### 安装
```shell
yarn add coa-ali-ots
```### 使用
```typescript
import { AliOtsBin, AliOtsStorage, AliOtsVersion } from 'coa-ali-ots'// TableStore配置
const config = {
accessKeyId: 'LTAI4XXXXXXXXX1DNpZDk',
accessKeySecret: 'TxqDw89E3wXXXXXXXXXXXXoWZy2hXvZ',
instance: 'instance-name',
endpoint: 'https://instance-name.cn-shanghai.ots.aliyuncs.com',
}// 初始化bin实例
const bin = new AliOtsBin(config)// 创建Version实例
const otsVersion = new AliOtsVersion(bin)// 根据项目名称返回一个新的版本号
await otsVersion.new('name') // 1// 创建存储实例
const otsStorage = new AliOtsStorage(bin)// 设置存储
await otsStorage.set('key1', 'data1')
// 读取存储
await otsStorage.get('key1') // "data1"
```更多的使用可以参考阿里云表格储存 Tablestore [官方文档](https://help.aliyun.com/document_detail/56350.html) 原文。