未验证 提交 3abe1b6a 编写于 作者: O openharmony_ci 提交者: Gitee

!16769 分布式数据管理接口文档格式和遗留问题修复

Merge pull request !16769 from Wangkai/master
......@@ -16,6 +16,8 @@
>- 从API Version 9开始,该接口不再维护,推荐使用新接口[`@ohos.data.distributedKVStore`](js-apis-distributedKVStore.md)。
>
>- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
>- 本模块中所有需要获取deviceId的接口,都仅系统应用可用。
## 导入模块
......@@ -88,25 +90,22 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
**示例:**
```js
let kvManager;
try {
const kvManagerConfig = {
bundleName : 'com.example.datamanagertest',
userInfo : {
userId : '0',
userType : distributedData.UserType.SAME_USER_ID
}
const kvManagerConfig = {
bundleName: 'com.example.datamanagertest',
userInfo: {
userId: '0',
userType: distributedData.UserType.SAME_USER_ID
}
distributedData.createKVManager(kvManagerConfig, function (err, manager) {
if (err) {
console.log("Failed to create KVManager: " + JSON.stringify(err));
return;
}
console.log("Succeeded in creating KVManager");
kvManager = manager;
});
}
distributedData.createKVManager(kvManagerConfig).then((manager) => {
console.log("Succeeded in creating KVManager");
kvManager = manager;
}).catch((err) => {
console.error("Failed to create KVManager: " + JSON.stringify(err));
});
} catch (e) {
console.log("An unexpected error occurred. Error:" + e);
console.log("An unexpected error occurred. Error:" + e);
}
```
......@@ -2012,6 +2011,10 @@ try {
deviceId(deviceId:string):Query
添加设备ID作为key的前缀。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core
......@@ -3664,6 +3667,10 @@ try {
removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void
删除指定设备的数据,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core
......@@ -3706,6 +3713,10 @@ try {
removeDeviceData(deviceId: string): Promise<void>
删除指定设备的数据,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core
......@@ -4084,6 +4095,10 @@ try {
get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|number|Uint8Array>): void
获取与指定设备ID和key匹配的string值,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4119,6 +4134,10 @@ try{
get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array>
获取与指定设备ID和key匹配的string值,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4163,6 +4182,10 @@ try {
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void
获取与指定设备ID和key前缀匹配的所有键值对,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4211,6 +4234,10 @@ try {
getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>
获取与指定设备ID和key前缀匹配的所有键值对,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4380,6 +4407,10 @@ try {
getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void
获取与指定设备ID和Query对象匹配的键值对列表,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4433,6 +4464,10 @@ try {
getEntries(deviceId: string, query: Query): Promise<Entry[]>
获取与指定设备ID和Query对象匹配的键值对列表,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4493,6 +4528,10 @@ try {
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void
获取与指定设备ID和key前缀匹配的KvStoreResultSet对象,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4528,6 +4567,10 @@ try {
getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet>
获取与指定设备ID和key前缀匹配的KvStoreResultSet对象,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4688,6 +4731,10 @@ try {
getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreResultSet>): void
获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4740,6 +4787,10 @@ try {
getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>
获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -4982,6 +5033,10 @@ try {
getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void;
获取与指定设备ID和Query对象匹配的结果数,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -5029,6 +5084,10 @@ try {
getResultSize(deviceId: string, query: Query): Promise<number>
获取与指定设备ID和Query对象匹配的结果数,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -5085,6 +5144,10 @@ try {
removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void
从当前数据库中删除指定设备的数据,使用callback异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......@@ -5127,6 +5190,10 @@ try {
removeDeviceData(deviceId: string): Promise<void>
从当前数据库中删除指定设备的数据,使用Promise异步回调。
> **说明:**
>
> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
> deviceId具体获取方式请参考[sync接口示例](#sync)。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册