Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
a2dfa7ad
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a2dfa7ad
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2143 Update Docs
Merge pull request !2143 from 吴冯山/master
上级
bcff1370
b6798e44
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
438 addition
and
160 deletion
+438
-160
zh-cn/application-dev/reference/apis/js-apis-distributed-data.md
...pplication-dev/reference/apis/js-apis-distributed-data.md
+438
-160
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-distributed-data.md
浏览文件 @
a2dfa7ad
...
...
@@ -9,8 +9,6 @@
```
import distributedData from '@ohos.data.distributedData';
```
## 系统能力
SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
...
...
@@ -21,6 +19,8 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>
创建一个KVManager对象实例,用于管理数据库对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
:SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -60,6 +60,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
创建一个KVManager对象实例,用于管理数据库对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -100,6 +102,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
提供KVManager实例的配置信息,包括调用方的包名和用户信息。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ------ | ------ |
| userInfo |
[
UserInfo
](
#userinfo
)
| 是 | 调用方的用户信息。 |
...
...
@@ -111,6 +115,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
用户信息。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ------ | ------ |
| userId | string | 是 | 指示要设置的用户ID。 |
...
...
@@ -121,6 +127,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
用户类型。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| ----- | ------ | ------ |
| SAME_USER_ID | 0 | 使用同一帐户登录不同设备的用户。 |
...
...
@@ -130,12 +138,16 @@ createKVManager(config: KVManagerConfig): Promise<KVManager>
数据管理实例,用于获取KVStore的相关信息。在调用KVManager的方法前,需要先通过createKVManager构建一个KVManager实例。
### getKVStore
getKVStore
<T
extends
KVStore
>
(storeId: string, options: Options, callback: AsyncCallback
<
T
>
): void
getKVStore
<
T extends KVStore
>
(storeId: string, options: Options, callback: AsyncCallback
<
T
>
): void
通过指定Options和storeId,创建并获取KVStore数据库,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -178,6 +190,8 @@ getKVStore<T extends KVStore>(storeId: string, options: Options): Promise&
通过指定Options和storeId,创建并获取KVStore数据库,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -220,10 +234,12 @@ getKVStore<T extends KVStore>(storeId: string, options: Options): Promise&
### closeKVStore<sup>8+</sup> ###
closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback
<
void
>
): void
;
closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback
<
void
>
): void
通过storId的值关闭指定的kvStore数据库,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
...
...
@@ -264,10 +280,12 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCa
### closeKVStore<sup>8+</sup> ###
closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise
<
void
>
;
closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise
<
void
>
通过kvStore的值关闭指定的kvStore数据库,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -316,10 +334,12 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void&
### deleteKVStore<sup>8+</sup> ###
deleteKVStore(appId: string, storeId: string, callback: AsyncCallback
<
void
>
): void
;
deleteKVStore(appId: string, storeId: string, callback: AsyncCallback
<
void
>
): void
通过storeId的值删除指定的kvStore数据库,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -358,10 +378,12 @@ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>
### deleteKVStore<sup>8+</sup> ###
deleteKVStore(appId: string, storeId: string): Promise
<
void
>
;
deleteKVStore(appId: string, storeId: string): Promise
<
void
>
通过storeId的值删除指定的kvStore数据库,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -410,10 +432,12 @@ deleteKVStore(appId: string, storeId: string): Promise<void>;
### getAllKVStoreId<sup>8+</sup> ###
getAllKVStoreId(appId: string, callback: AsyncCallback
<
string[]
>
): void
;
getAllKVStoreId(appId: string, callback: AsyncCallback
<
string[]
>
): void
获取所有通过getKvStore方法创建的且没有调用deleteKvStore方法删除的KvStore数据库的storeId,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -438,10 +462,12 @@ getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void;
### getAllKVStoreId<sup>8+</sup> ###
getAllKVStoreId(appId: string): Promise
<
string[]
>
;
getAllKVStoreId(appId: string): Promise
<
string[]
>
获取所有通过getKvStore方法创建的且没有调用deleteKvStore方法删除的KvStore数据库的storeId,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -475,10 +501,12 @@ getAllKVStoreId(appId: string): Promise<string[]>;
### on<sup>8+</sup> ###
on(event: 'distributedDataServiceDie', deathCallback: Callback
<
void
>
): void
;
on(event: 'distributedDataServiceDie', deathCallback: Callback
<
void
>
): void
订阅服务状态变更通知,并通过callback方式返回,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -507,10 +535,12 @@ on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): voi
### off<sup>8+</sup> ###
off(event: 'distributedDataServiceDie', deathCallback?: Callback
<
void
>
): void
;
off(event: 'distributedDataServiceDie', deathCallback?: Callback
<
void
>
): void
取消订阅服务状态变更通知,并通过callback方式返回,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -539,6 +569,8 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v
用于提供创建数据库的配置信息。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| createIfMissing | boolean | 否 | 当数据库文件不存在时是否创建数据库,默认创建。 |
...
...
@@ -547,12 +579,15 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v
| autoSync | boolean | 否 |设置数据库文件是否自动同步,默认不自动同步。 |
| kvStoreType |
[
KVStoreType
](
#kvstoretype
)
| 否 |设置要创建的数据库类型,默认为多设备协同数据库。 |
| securityLevel |
[
SecurityLevel
](
#securitylevel
)
| 否 |设置数据库安全级别,默认不设置安全级别。 |
| schema |
[
schema
](
#Schema
<sup>
8+
</sup>
) | 否 | 设置定义存储在数据库中的值。 |
## KVStoreType
用于指定创建的数据库的类型。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| --- | ---- | ----------------------- |
| DEVICE_COLLABORATION | 0 | 表示多设备协同数据库。 |
...
...
@@ -565,6 +600,8 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v
用于指定创建的数据库的安全级别。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| --- | ---- | ----------------------- |
| NO_LEVEL | 0 | 表示数据库不设置安全级别。 |
...
...
@@ -579,6 +616,8 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v
KVStore常量。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| --- | ---- | ----------------------- |
| MAX_KEY_LENGTH | 1024 | 数据库中Key允许最大长度,单位字节。 |
...
...
@@ -592,42 +631,57 @@ KVStore常量。
表示数据库模式,可以在创建或打开数据库时创建 Schema 对象并将它们放入 Options 中。
### toJsonString<sup>8+</sup> ###
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
toJsonString():string;
获取 json 格式的 schema 。
-
返回值:
| 名称 | 类型 | 说明 |
| --- | ---- | ----------------------- |
| root
<sup>
8+
</sup>
|
[
FieldNode
](
#FieldNode
)
| 表示json根对象 |
| indexes
<sup>
8+
</sup>
| Array
<string>
| 表示json类型的字符串数组。 |
| mode
<sup>
8+
</sup>
| number | 表示Schema的模式。 |
| skip
<sup>
8+
</sup>
| number | Schema的跳跃大小。 |
| 类型 | 说明 |
| ------------- | -------------- |
| string |以 json 格式返回Schema。 |
### constructor<sup>8+</sup> ###
-
示例
constructor()
```
import ddm from '@ohos.data.distributedData';
try {
let schema = new ddm.Schema();
const str = schema.toJsonString();
console.log("schema: " + str);
} catch (e) {
console.log("toJsonString " + e);
}
```
用于创建Schema实例的构造函数。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
## FieldNode<sup>8+</sup> ##
表示 Schema 实例的节点,提供定义存储在数据库中的值的方法。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
| 名称 | 类型 | 说明 |
| --- | ---- | ----------------------- |
| nullable
<sup>
8+
</sup>
| boolean | 表示数据库字段是否可以为空。 |
| default
<sup>
8+
</sup>
| string | 表示fieldnode的默认值。 |
| type
<sup>
8+
</sup>
| number | 表示值。 |
### constructor<sup>8+</sup> ###
constructor(name: string)
用于创建带有string字段FieldNode实例的构造函数。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| name | string | 是 | FieldNode的值。
### appendChild<sup>8+</sup> ###
appendChild(child: FieldNode): boolean
;
appendChild(child: FieldNode): boolean
向这个 FieldNode 添加一个子节点。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -664,43 +718,21 @@ appendChild(child: FieldNode): boolean;
```
### toJson<sup>8+</sup> ###
toJson(): string;
获取字段名称。
-
返回值:
| 类型 | 说明 |
| ------ | -------------- |
| string |返回节点的字段名称。 |
-
示例
```
import ddm from '@ohos.data.distributedData';
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode("child");
node.appendChild(child);
console.log("appendNode " + node.toJson());
} catch (e) {
console.log("ToJson " + e);
}
```
## KvStoreResultSet<sup>8+</sup> ##
提供获取KvStore数据库结果集的方法,提供查询和移动数据读取位置的方法,在调用KvStoreResultSet的方法前,需要先通过KvStore 构建一个KvStore 实例。
### getCount<sup>8+</sup> ###
getCount(): number
;
getCount(): number
获取结果集中的行数。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -729,10 +761,12 @@ getCount(): number;
### getPosition<sup>8+</sup> ###
getPosition(): number
;
getPosition(): number
获取结果集中当前的读取位置。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -761,10 +795,12 @@ getPosition(): number;
### moveToFirst<sup>8+</sup> ###
moveToFirst(): boolean
;
moveToFirst(): boolean
将读取位置移动到第一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -793,10 +829,12 @@ moveToFirst(): boolean;
### moveToLast<sup>8+</sup> ###
moveToLast(): boolean
;
moveToLast(): boolean
将读取位置移动到最后一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -825,10 +863,12 @@ moveToLast(): boolean;
### moveToNext<sup>8+</sup> ###
moveToNext(): boolean
;
moveToNext(): boolean
将读取位置移动到下一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -857,10 +897,12 @@ moveToNext(): boolean;
### moveToPrevious<sup>8+</sup> ###
moveToPrevious(): boolean
;
moveToPrevious(): boolean
将读取位置移动到上一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -889,10 +931,12 @@ moveToPrevious(): boolean;
### move<sup>8+</sup> ###
move(offset: number): boolean
;
move(offset: number): boolean
将读取位置移动到当前位置的相对偏移量。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -927,10 +971,12 @@ move(offset: number): boolean;
### moveToPosition<sup>8+</sup> ###
moveToPosition(position: number): boolean
;
moveToPosition(position: number): boolean
将读取位置从 0 移动到绝对位置。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -965,10 +1011,12 @@ moveToPosition(position: number): boolean;
### isFirst<sup>8+</sup> ###
isFirst(): boolean
;
isFirst(): boolean
检查读取位置是否为第一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -997,10 +1045,12 @@ isFirst(): boolean;
### isLast<sup>8+</sup> ###
isLast(): boolean
;
isLast(): boolean
检查读取位置是否为最后一行。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1029,10 +1079,12 @@ isLast(): boolean;
### isBeforeFirst<sup>8+</sup> ###
isBeforeFirst(): boolean
;
isBeforeFirst(): boolean
检查读取位置是否在第一行之前。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1061,10 +1113,12 @@ isBeforeFirst(): boolean;
### isAfterLast<sup>8+</sup> ###
isAfterLast(): boolean
;
isAfterLast(): boolean
检查读取位置是否在最后一行之后。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1093,10 +1147,12 @@ isAfterLast(): boolean;
### getEntry<sup>8+</sup> ###
getEntry(): Entry
;
getEntry(): Entry
获取键值对
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1128,12 +1184,26 @@ getEntry(): Entry;
使用谓词表示数据库查询,提供创建Query实例、查询数据库中的数据和添加谓词的方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
### constructor<sup>8+</sup> ###
constructor()
用于创建Schema实例的构造函数
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
### reset<sup>8+</sup> ###
reset(): Query
;
reset(): Query
公共查询重置。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1162,6 +1232,8 @@ equalTo(field: string, value: number|string|boolean): Query;
构造一个Query对象来查询具有指定字段的条目,其值等于指定的值。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1191,10 +1263,12 @@ equalTo(field: string, value: number|string|boolean): Query;
### notEqualTo<sup>8+</sup> ###
notEqualTo(field: string, value: number|string|boolean): Query
;
notEqualTo(field: string, value: number|string|boolean): Query
构造一个Query对象以查询具有指定字段且值不等于指定值的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1224,10 +1298,12 @@ notEqualTo(field: string, value: number|string|boolean): Query;
### greaterThan<sup>8+</sup> ###
greaterThan(field: string, value: number|string|boolean): Query
;
greaterThan(field: string, value: number|string|boolean): Query
构造一个Query对象以查询具有大于指定值的指定字段的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1257,10 +1333,12 @@ greaterThan(field: string, value: number|string|boolean): Query;
### lessThan<sup>8+</sup> ###
lessThan(field: string, value: number|string): Query
;
lessThan(field: string, value: number|string): Query
构造一个Query对象以查询具有小于指定值的指定字段的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1290,10 +1368,12 @@ lessThan(field: string, value: number|string): Query;
### greaterThanOrEqualTo<sup>8+</sup> ###
greaterThanOrEqualTo(field: string, value: number|string): Query
;
greaterThanOrEqualTo(field: string, value: number|string): Query
构造一个Query对象以查询具有指定字段且值大于或等于指定值的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1323,10 +1403,12 @@ greaterThanOrEqualTo(field: string, value: number|string): Query;
### lessThanOrEqualTo<sup>8+</sup> ###
lessThanOrEqualTo(field: string, value: number|string): Query
;
lessThanOrEqualTo(field: string, value: number|string): Query
构造一个Query对象以查询具有指定字段且值小于或等于指定值的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1356,10 +1438,13 @@ lessThanOrEqualTo(field: string, value: number|string): Query;
### isNull<sup>8+</sup> ###
isNull(field: string): Query
;
isNull(field: string): Query
构造一个Query对象以查询具有值为null的指定字段的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1388,10 +1473,13 @@ isNull(field: string): Query;
### inNumber<sup>8+</sup> ###
inNumber(field: string, valueList: number[]): Query
;
inNumber(field: string, valueList: number[]): Query
构造一个Query对象以查询具有指定字段的条目,其值在指定的值列表中。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1422,10 +1510,12 @@ inNumber(field: string, valueList: number[]): Query;
### inString<sup>8+</sup> ###
inString(field: string, valueList: string[]): Query
;
inString(field: string, valueList: string[]): Query
构造一个Query对象以查询具有指定字段的条目,其值在指定的字符串值列表中。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1455,10 +1545,12 @@ inString(field: string, valueList: string[]): Query;
### notInNumber<sup>8+</sup> ###
notInNumber(field: string, valueList: number[]): Query
;
notInNumber(field: string, valueList: number[]): Query
构造一个Query对象以查询具有指定字段的条目,该字段的值不在指定的值列表中。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1488,10 +1580,12 @@ notInNumber(field: string, valueList: number[]): Query;
### notInString<sup>8+</sup> ###
notInString(field: string, valueList: string[]): Query
;
notInString(field: string, valueList: string[]): Query
构造一个Query对象以查询具有指定字段且值不在指定字符串值列表中的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1521,10 +1615,12 @@ notInString(field: string, valueList: string[]): Query;
### like<sup>8+</sup> ###
like(field: string, value: string): Query
;
like(field: string, value: string): Query
构造一个Query对象以查询具有与指定字符串值相似的指定字段的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1554,10 +1650,12 @@ like(field: string, value: string): Query;
### unlike<sup>8+</sup> ###
unlike(field: string, value: string): Query
;
unlike(field: string, value: string): Query
构造一个Query对象以查询具有与指定字符串值不相似的指定字段的条目。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1587,10 +1685,12 @@ unlike(field: string, value: string): Query;
### and<sup>8+</sup> ###
and(): Query
;
and(): Query
构造一个带有与条件的查询对象。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1615,10 +1715,12 @@ and(): Query;
### or<sup>8+</sup> ###
or(): Query
;
or(): Query
构造一个带有或条件的Query对象。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1643,10 +1745,12 @@ or(): Query;
### orderByAsc<sup>8+</sup> ###
orderByAsc(field: string): Query
;
orderByAsc(field: string): Query
构造一个Query对象,将查询结果按升序排序。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1676,10 +1780,12 @@ orderByAsc(field: string): Query;
### orderByDesc<sup>8+</sup> ###
orderByDesc(field: string): Query
;
orderByDesc(field: string): Query
构造一个Query对象,将查询结果按降序排序。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1710,10 +1816,12 @@ orderByDesc(field: string): Query;
### limit<sup>8+</sup> ###
limit(total: number, offset: number): Query
;
limit(total: number, offset: number): Query
构造一个Query对象来指定结果的数量和开始位置。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1744,10 +1852,12 @@ limit(total: number, offset: number): Query;
### isNotNull<sup>8+</sup> ###
isNotNull(field: string): Query
;
isNotNull(field: string): Query
使用不为空的指定字段创建查询条件。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1776,10 +1886,12 @@ isNotNull(field: string): Query;
### beginGroup<sup>8+</sup> ###
beginGroup(): Query
;
beginGroup(): Query
创建一个带有左括号的查询条件组。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1804,10 +1916,12 @@ beginGroup(): Query;
### endGroup<sup>8+</sup> ###
endGroup(): Query
;
endGroup(): Query
创建一个带有右括号的查询条件组。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1832,10 +1946,12 @@ endGroup(): Query;
### prefixKey<sup>8+</sup> ###
prefixKey(prefix: string): Query
;
prefixKey(prefix: string): Query
创建具有指定键前缀的查询条件。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1865,10 +1981,12 @@ prefixKey(prefix: string): Query;
### setSuggestIndex<sup>8+</sup> ###
setSuggestIndex(index: string): Query
;
setSuggestIndex(index: string): Query
设置一个指定的索引,将优先用于查询。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1898,10 +2016,12 @@ setSuggestIndex(index: string): Query;
### deviceId<sup>8+</sup> ###
deviceId(deviceId:string):Query
;
deviceId(deviceId:string):Query
添加设备ID作为key的前缀。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1930,10 +2050,12 @@ deviceId(deviceId:string):Query;
### getSqlLike<sup>8+</sup> ###
getSqlLike():string
;
getSqlLike():string
获取指定Query对象的查询语句。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -1957,12 +2079,16 @@ getSqlLike():string;
KVStore数据库实例,提供增加数据、删除数据和订阅数据变更、订阅同步完成的方法。在调用KVStore的方法前,需要先通过getKVStore构建一个KVStore实例。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
### put
put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback
<
void
>
): void
添加指定类型键值对到数据库,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -1997,6 +2123,8 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise<void
添加指定类型键值对到数据库,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2035,6 +2163,8 @@ delete(key: string, callback: AsyncCallback<void>): void
从数据库中删除指定键值的数据,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2075,6 +2205,8 @@ delete(key: string): Promise<void>
从数据库中删除指定键值的数据,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2116,6 +2248,8 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific
订阅指定类型的数据变更通知,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2137,16 +2271,18 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific
### on
on(event: 'syncComplete', syncCallback: Callback
<Array
<
[string, number]
>
): void
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>
>
): void
订阅同步完成事件回调通知,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | 是 |回调函数名称。 |
| syncCallback |Callback
<
Array
<
[string, number]
>
| 是 |回调函数。 |
| syncCallback |Callback
<
Array
<
[string, number]
>
>
| 是 |回调函数。 |
-
示例
...
...
@@ -2160,10 +2296,12 @@ on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>):
### off<sup>8+</sup>
off(event:'dataChange', observer?: Callback
<
ChangeNotification
>
): void
;
off(event:'dataChange', observer?: Callback
<
ChangeNotification
>
): void
取消订阅数据变更通知,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2186,10 +2324,12 @@ off(event:'dataChange', observer?: Callback<ChangeNotification>): void;
### putBatch<sup>8+</sup>
putBatch(entries: Entry[], callback: AsyncCallback
<
void
>
): void
;
putBatch(entries: Entry[], callback: AsyncCallback
<
void
>
): void
批量插入键值对到KvStore数据库中,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2232,10 +2372,12 @@ putBatch(entries: Entry[], callback: AsyncCallback<void>): void;
### putBatch<sup>8+</sup>
putBatch(entries: Entry[]): Promise
<
void
>
;
putBatch(entries: Entry[]): Promise
<
void
>
批量插入键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2285,10 +2427,12 @@ putBatch(entries: Entry[]): Promise<void>;
### deleteBatch<sup>8+</sup>
deleteBatch(keys: string[], callback: AsyncCallback
<
void
>
): void
;
deleteBatch(keys: string[], callback: AsyncCallback
<
void
>
): void
批量删除KvStore数据库中的键值对,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2330,10 +2474,12 @@ deleteBatch(keys: string[], callback: AsyncCallback<void>): void;
### deleteBatch<sup>8+</sup> ###
deleteBatch(keys: string[]): Promise
<
void
>
;
deleteBatch(keys: string[]): Promise
<
void
>
批量删除键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2384,10 +2530,12 @@ deleteBatch(keys: string[]): Promise<void>;
### startTransaction<sup>8+</sup> ###
startTransaction(callback: AsyncCallback
<
void
>
): void
;
startTransaction(callback: AsyncCallback
<
void
>
): void
启动KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2434,10 +2582,12 @@ startTransaction(callback: AsyncCallback<void>): void;
### startTransaction<sup>8+</sup> ###
startTransaction(): Promise
<
void
>
;
startTransaction(): Promise
<
void
>
启动KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -2467,10 +2617,12 @@ startTransaction(): Promise<void>;
### commit<sup>8+</sup> ###
commit(callback: AsyncCallback
<
void
>
): void
;
commit(callback: AsyncCallback
<
void
>
): void
提交KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2497,10 +2649,12 @@ commit(callback: AsyncCallback<void>): void;
### commit<sup>8+</sup> ###
commit(): Promise
<
void
>
;
commit(): Promise
<
void
>
提交KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -2525,10 +2679,12 @@ commit(): Promise<void>;
### rollback<sup>8+</sup> ###
rollback(callback: AsyncCallback
<
void
>
): void
;
rollback(callback: AsyncCallback
<
void
>
): void
在KvStore数据库中回滚事务,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2555,10 +2711,12 @@ rollback(callback: AsyncCallback<void>): void;
### rollback<sup>8+</sup> ###
rollback(): Promise
<
void
>
;
rollback(): Promise
<
void
>
在KvStore数据库中回滚事务,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -2583,10 +2741,12 @@ rollback(): Promise<void>;
### enableSync<sup>8+</sup> ###
enableSync(enabled: boolean, callback: AsyncCallback
<
void
>
): void
;
enableSync(enabled: boolean, callback: AsyncCallback
<
void
>
): void
设定是否开启同步,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2614,10 +2774,12 @@ enableSync(enabled: boolean, callback: AsyncCallback<void>): void;
### enableSync<sup>8+</sup> ###
enableSync(enabled: boolean): Promise
<
void
>
;
enableSync(enabled: boolean): Promise
<
void
>
设定是否开启同步,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2648,10 +2810,12 @@ enableSync(enabled: boolean): Promise<void>;
### setSyncRange<sup>8+</sup> ###
setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback
<
void
>
): void
;
setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback
<
void
>
): void
设置同步范围标签,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2678,10 +2842,12 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: Asy
### setSyncRange<sup>8+</sup> ###
setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise
<
void
>
;
setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise
<
void
>
设置同步范围标签,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2718,6 +2884,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
描述订阅类型。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| ----- | ------ | ----------------------- |
| SUBSCRIBE_TYPE_LOCAL |0 |表示订阅本地数据变更。 |
...
...
@@ -2728,6 +2896,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
数据变更时通知的对象,包括数据插入的数据、更新的数据、删除的数据和设备ID。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 参数类型 |可读 |可写 | 说明 |
| ----- | ------- | -----| ------|------------------------ |
| insertEntries |
[
Entry
](
#entry
)[]
| 是 | 是 |数据添加记录。 |
...
...
@@ -2739,6 +2909,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
存储在数据库中的键值对。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 参数类型 |可读 |可写 | 说明 |
| ----- | ------- | -----| ------|------------------------ |
| key | string | 是 | 是 |键值。 |
...
...
@@ -2749,6 +2921,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
存储在数据库中的对象。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 参数类型 |可读 |可写 | 说明 |
| ----- | ------- | -----| ------|------------------------ |
| type |
[
ValueType
](
#value
)
| 是 | 是 |值类型。 |
...
...
@@ -2760,6 +2934,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
只能被内部应用使用。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| ----- | ------ | ----------------------- |
| STRING |0 |表示值类型为字符串。 |
...
...
@@ -2773,12 +2949,16 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v
单版本分布式数据库,继承自KVStore,提供查询数据和同步数据的方法。在调用 SingleKVStore 的方法前,需要先通过 getKVStore 构建一个 SingleKVStore 实例。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
### get
get(key: string, callback: AsyncCallback
<
Uint8Array | string | boolean | number
>
): void
获取指定键的值,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2811,10 +2991,12 @@ get(key: string, callback: AsyncCallback<Uint8Array | string | boolean | numb
### get
get(key: string): Promise
<
Uint8Array | string | boolean | number
>
;
get(key: string): Promise
<
Uint8Array | string | boolean | number>
获取指定键的值,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2853,10 +3035,12 @@ get(key: string): Promise<Uint8Array | string | boolean | number>
### getEntries<sup>8+</sup> ###
getEntries(keyPrefix: string, callback: AsyncCallback
<
Entry[]
>
): void
;
getEntries(keyPrefix: string, callback: AsyncCallback
<
Entry[]
>
): void
获取匹配指定键前缀的所有键值对,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2897,10 +3081,12 @@ getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
### getEntries<sup>8+</sup> ###
getEntries(keyPrefix: string): Promise
<
Entry[]
>
;
getEntries(keyPrefix: string): Promise
<
Entry[]
>
获取匹配指定键前缀的所有键值对,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -2953,10 +3139,12 @@ getEntries(keyPrefix: string): Promise<Entry[]>;
### getEntries<sup>8+</sup> ###
getEntries(query: Query, callback: AsyncCallback
<
Entry[]
>
): void
;
getEntries(query: Query, callback: AsyncCallback
<
Entry[]
>
): void
获取与指定 Query 对象匹配的键值对列表,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3002,10 +3190,12 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
### getEntries<sup>8+</sup> ###
getEntries(query: Query): Promise
<
Entry[]
>
;
getEntries(query: Query): Promise
<
Entry[]
>
获取匹配指定键前缀的所有键值对,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3057,10 +3247,12 @@ getEntries(query: Query): Promise<Entry[]>;
### getResultSet<sup>8+</sup> ###
getResultSet(keyPrefix: string, callback: AsyncCallback
<
KvStoreResultSet
>
): void
;
getResultSet(keyPrefix: string, callback: AsyncCallback
<
KvStoreResultSet
>
): void
从 KvStore 数据库中获取具有指定前缀的结果集,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3104,10 +3296,12 @@ getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>)
### getResultSet<sup>8+</sup> ###
getResultSet(keyPrefix: string): Promise
<
KvStoreResultSet
>
;
getResultSet(keyPrefix: string): Promise
<
KvStoreResultSet
>
从 KvStore 数据库中获取具有指定前缀的结果集,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3162,10 +3356,12 @@ getResultSet(keyPrefix: string): Promise<KvStoreResultSet>;
### getResultSet<sup>8+</sup> ###
getResultSet(query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
;
getResultSet(query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3208,10 +3404,12 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi
### getResultSet<sup>8+</sup> ###
getResultSet(query: Query): Promise
<
KvStoreResultSet
>
;
getResultSet(query: Query): Promise
<
KvStoreResultSet
>
获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3262,10 +3460,12 @@ getResultSet(query: Query): Promise<KvStoreResultSet>;
### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback
<
void
>
): void
;
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback
<
void
>
): void
关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3294,10 +3494,12 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>)
### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet): Promise
<
void
>
;
closeResultSet(resultSet: KvStoreResultSet): Promise
<
void
>
关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3329,10 +3531,12 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void>;
### getResultSize<sup>8+</sup> ###
getResultSize(query: Query, callback: AsyncCallback
<
number
>
): void
;
getResultSize(query: Query, callback: AsyncCallback
<
number
>
): void
获取与指定 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3373,10 +3577,12 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void;
### getResultSize<sup>8+</sup> ###
getResultSize(query: Query): Promise
<
number
>
;
getResultSize(query: Query): Promise
<
number
>
获取与指定 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3426,10 +3632,12 @@ getResultSize(query: Query): Promise<number>;
### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string, callback: AsyncCallback
<
void
>
): void
;
removeDeviceData(deviceId: string, callback: AsyncCallback
<
void
>
): void
删除指定设备的数据,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3466,10 +3674,12 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string): Promise
<
void
>
;
removeDeviceData(deviceId: string): Promise
<
void
>
删除指定设备的数据,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3513,16 +3723,18 @@ removeDeviceData(deviceId: string): Promise<void>;
### on<sup>8+</sup> ###
on(event: 'syncComplete', syncCallback: Callback
<Array
<
[string, number]
>
): void;
on(event: 'syncComplete', syncCallback: Callback
<
Array
<
[string, number]
>>
): void
订阅同步完成事件回调通知,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | 是 |同步完成时触发的事件名。 |
| syncCallback |Callback
<Array
<
[string, number]
>
| 是 |用于向调用方发送同步结果的回调。 |
| syncCallback |Callback
<
Array
<
[string, number]
>
>
| 是 |用于向调用方发送同步结果的回调。 |
-
示例
...
...
@@ -3547,16 +3759,18 @@ on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>):
### off<sup>8+</sup> ###
off(event: 'syncComplete', syncCallback?: Callback
<Array
<
[string, number]
>
): void;
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
取消订阅同步完成事件回调通知,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | 是 |同步完成时触发的事件名。 |
| syncCallback |Callback
<Array
<
[string, number]
>
| 否 |用于向调用方发送同步结果的回调。 |
| syncCallback |Callback
<
Array
<
[string, number]
>
>
| 否 |用于向调用方发送同步结果的回调。 |
-
示例
...
...
@@ -3581,6 +3795,8 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
在手动模式下,触发数据库同步,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3598,10 +3814,12 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
### setSyncParam<sup>8+</sup> ###
setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback
<
void
>
): void
;
setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback
<
void
>
): void
设置允许数据库同步的默认延迟,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3627,10 +3845,12 @@ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>)
### setSyncParam<sup>8+</sup> ###
setSyncParam(defaultAllowedDelayMs: number): Promise
<
void
>
;
setSyncParam(defaultAllowedDelayMs: number): Promise
<
void
>
设置允许数据库同步的默认延迟,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3663,10 +3883,12 @@ setSyncParam(defaultAllowedDelayMs: number): Promise<void>;
### getSecurityLevel<sup>8+</sup> ###
getSecurityLevel(callback: AsyncCallback
<
SecurityLevel
>
): void
;
getSecurityLevel(callback: AsyncCallback
<
SecurityLevel
>
): void
获取数据库的安全级别,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3689,10 +3911,12 @@ getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void;
### getSecurityLevel<sup>8+</sup> ###
getSecurityLevel(): Promise
<
SecurityLevel
>
;
getSecurityLevel(): Promise
<
SecurityLevel
>
获取数据库的安全级别,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
返回值:
| 类型 | 说明 |
...
...
@@ -3720,12 +3944,16 @@ getSecurityLevel(): Promise<SecurityLevel>;
在分布式系统中按设备管理分布式数据,继承自KvStore,提供查询数据和同步数据的方法。在调用DeviceKVStore的方法前,需要先通过getKVStore构建一个DeviceKVStore实例。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
### get<sup>8+</sup> ###
get(deviceId: string, key: string, callback: AsyncCallback
<
boolean|string|number|Uint8Array
>
): void
;
get(deviceId: string, key: string, callback: AsyncCallback
<
boolean|string|number|Uint8Array
>
): void
获取与指定设备 ID 和 key 匹配的 String 值,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3756,10 +3984,12 @@ get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|num
### get<sup>8+</sup> ###
get(deviceId: string, key: string): Promise
<
boolean|string|number|Uint8Array
>
;
get(deviceId: string, key: string): Promise
<
boolean|string|number|Uint8Array
>
获取与指定设备 ID 和 key 匹配的 String 值,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3798,10 +4028,12 @@ get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array&
### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback
<
Entry[]
>
): void
;
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback
<
Entry[]
>
): void
获取与指定设备 ID 和 key 前缀匹配的所有键值对,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3844,10 +4076,12 @@ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry
### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, keyPrefix: string): Promise
<
Entry[]
>
;
getEntries(deviceId: string, keyPrefix: string): Promise
<
Entry[]
>
获取与指定设备 ID 和 key 前缀匹配的所有键值对,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3901,10 +4135,12 @@ getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>;
### getEntries<sup>8+</sup> ###
getEntries(query: Query, callback: AsyncCallback
<
Entry[]
>
): void
;
getEntries(query: Query, callback: AsyncCallback
<
Entry[]
>
): void
获取与指定 Query 对象匹配的键值对列表,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -3952,10 +4188,12 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
### getEntries<sup>8+</sup> ###
getEntries(query: Query): Promise
<
Entry[]
>
;
getEntries(query: Query): Promise
<
Entry[]
>
获取与指定 Query 对象匹配的键值对列表,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4008,10 +4246,12 @@ getEntries(query: Query): Promise<Entry[]>;
### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, query: Query, callback: AsyncCallback
<
Entry[]
>
): void
;
getEntries(deviceId: string, query: Query, callback: AsyncCallback
<
Entry[]
>
): void
获取与指定设备 ID 和 Query 对象匹配的键值对列表,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4060,10 +4300,12 @@ getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>
### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, query: Query): Promise
<
Entry[]
>
;
getEntries(deviceId: string, query: Query): Promise
<
Entry[]
>
获取与指定设备 ID 和 Query 对象匹配的键值对列表,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4118,10 +4360,12 @@ getEntries(deviceId: string, query: Query): Promise<Entry[]>;
### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback
<
KvStoreResultSet
>
): void
;
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback
<
KvStoreResultSet
>
): void
获取与指定设备 ID 和 key 前缀匹配的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4151,10 +4395,12 @@ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvS
### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, keyPrefix: string): Promise
<
KvStoreResultSet
>
;
getResultSet(deviceId: string, keyPrefix: string): Promise
<
KvStoreResultSet
>
获取与指定设备 ID 和 key 前缀匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4193,10 +4439,12 @@ getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet&g
### getResultSet<sup>8+</sup> ###
getResultSet(query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
;
getResultSet(query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4243,10 +4491,12 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi
### getResultSet<sup>8+</sup> ###
getResultSet(query: Query): Promise
<
KvStoreResultSet
>
;
getResultSet(query: Query): Promise
<
KvStoreResultSet
>
获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4305,10 +4555,12 @@ getResultSet(query: Query): Promise<KvStoreResultSet>;
### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
;
getResultSet(deviceId: string, query: Query, callback: AsyncCallback
<
KvStoreResultSet
>
): void
获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4355,10 +4607,12 @@ getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreR
### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, query: Query): Promise
<
KvStoreResultSet
>
;
getResultSet(deviceId: string, query: Query): Promise
<
KvStoreResultSet
>
获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4419,10 +4673,12 @@ getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>;
### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback
<
void
>
): void
;
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback
<
void
>
): void
关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4452,10 +4708,12 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>)
### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet): Promise
<
void
>
;
closeResultSet(resultSet: KvStoreResultSet): Promise
<
void
>
关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4488,10 +4746,12 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void>;
### getResultSize<sup>8+</sup> ###
getResultSize(query: Query, callback: AsyncCallback
<
number
>
): void
;
getResultSize(query: Query, callback: AsyncCallback
<
number
>
): void
获取与指定 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4533,10 +4793,12 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void;
### getResultSize<sup>8+</sup> ###
getResultSize(query: Query): Promise
<
number
>
;
getResultSize(query: Query): Promise
<
number
>
获取与指定 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4591,6 +4853,8 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number&
获取与指定设备 ID 和 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4632,10 +4896,12 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number&
### getResultSize<sup>8+</sup> ###
getResultSize(deviceId: string, query: Query): Promise
<
number
>
;
getResultSize(deviceId: string, query: Query): Promise
<
number
>
获取与指定设备 ID 和 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4686,10 +4952,12 @@ getResultSize(deviceId: string, query: Query): Promise<number>;
### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string, callback: AsyncCallback
<
void
>
): void
;
removeDeviceData(deviceId: string, callback: AsyncCallback
<
void
>
): void
从当前数据库中删除指定设备的数据,并通过callback方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4726,10 +4994,12 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string): Promise
<
void
>
;
removeDeviceData(deviceId: string): Promise
<
void
>
从当前数据库中删除指定设备的数据,并通过Promise方式返回,此方法为异步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4773,10 +5043,12 @@ removeDeviceData(deviceId: string): Promise<void>;
### sync<sup>8+</sup> ###
sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
;
sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
在手动模式下,触发数据库同步,此方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4809,10 +5081,12 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void;
### on<sup>8+</sup> ###
on(event: 'syncComplete', syncCallback: Callback
<Arrary
<
<[string, number]
>
): void;
on(event: 'syncComplete', syncCallback: Callback
<
Arrary
<
[string, number]
>>
): void
订阅同步完成事件回调通知,该方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
...
...
@@ -4841,16 +5115,18 @@ on(event: 'syncComplete', syncCallback: Callback<Arrary<<[string, number]>
### off<sup>8+</sup> ###
off(event: 'syncComplete', syncCallback?: Callback
<Array
<
[string, number]
>
): void;
off(event: 'syncComplete', syncCallback?: Callback
<
Array
<
[string, number]
>>
): void
取消订阅同步完成事件回调通知,该方法为同步方法。
**系统能力**
: SystemCapability.DistributedDataManager.KVStore.Core。
-
参数:
| 参数名 | 参数类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | 是 |同步完成时触发的事件名。 |
| syncCallback |Callback<Arrary
<
<[string, number]
>
| 否 |用于向调用方发送同步结果的回调。 |
| syncCallback |Callback<Arrary
<
[string, number]
>
>
| 否 |用于向调用方发送同步结果的回调。 |
-
示例
...
...
@@ -4873,6 +5149,8 @@ off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>
用于指定同步模式。
**系统能力**
:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。
| 名称 | 默认值 | 说明 |
| ----- | ------ | ----------------------- |
| PULL_ONLY |0 |表示只能从远端拉取数据到本端。 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录