diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index 0e9a71b9eb758781bb14063c596d7c297bb15e14..01fafb6419a1c70d09c04345b02ad8f1c3f38df9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -9,14 +9,14 @@ ``` import distributedData from '@ohos.data.distributedData'; ``` -## 系统能力 -SystemCapability.DistributedDataManager.KVStore.DistributedKVStore ## distributedData.createKVManager +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void 创建一个KVManager对象实例,用于管理数据库对象,并通过callback方式返回,此方法为异步方法。 @@ -56,6 +56,8 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager> ## distributedData.createKVManager +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + createKVManager(config: KVManagerConfig): Promise<KVManager> 创建一个KVManager对象实例,用于管理数据库对象,并通过Promise方式返回,此方法为异步方法。 @@ -98,6 +100,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> ## KVManagerConfig +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + 提供KVManager实例的配置信息,包括调用方的包名和用户信息。 | 参数名 | 参数类型 | 必填 | 说明 | @@ -109,6 +113,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> ## UserInfo +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + 用户信息。 | 名称 | 参数类型 | 必填 | 说明 | @@ -118,6 +124,8 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> ## UserType +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + 用户类型。 @@ -128,11 +136,15 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> ## KVManager +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + 数据管理实例,用于获取KVStore的相关信息。在调用KVManager的方法前,需要先通过createKVManager构建一个KVManager实例。 ### getKVStore -getKVStore(storeId: string, options: Options, callback: AsyncCallback<T>): void +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + +getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void 通过指定Options和storeId,创建并获取KVStore数据库,并通过callback方式返回,此方法为异步方法。 @@ -174,6 +186,9 @@ getKVStore(storeId: string, options: Options, callback: Async ### getKVStore +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + + getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> 通过指定Options和storeId,创建并获取KVStore数据库,并通过Promise方式返回,此方法为异步方法。 @@ -220,10 +235,12 @@ getKVStore<T extends KVStore>(storeId: string, options: Options): Promise& ### closeKVStore8+ ### -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 +281,12 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCa ### closeKVStore8+ ### -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 +335,12 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void& ### deleteKVStore8+ ### -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 +379,12 @@ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void> ### deleteKVStore8+ ### -deleteKVStore(appId: string, storeId: string): Promise<void>; +deleteKVStore(appId: string, storeId: string): Promise<void> 通过storeId的值删除指定的kvStore数据库,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -410,10 +433,12 @@ deleteKVStore(appId: string, storeId: string): Promise<void>; ### getAllKVStoreId8+ ### -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 +463,12 @@ getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void; ### getAllKVStoreId8+ ### -getAllKVStoreId(appId: string): Promise<string[]>; +getAllKVStoreId(appId: string): Promise<string[]> 获取所有通过getKvStore方法创建的且没有调用deleteKvStore方法删除的KvStore数据库的storeId,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -475,10 +502,12 @@ getAllKVStoreId(appId: string): Promise<string[]>; ### on8+ ### -on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void; +on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void 订阅服务状态变更通知,并通过callback方式返回,此方法为同步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -507,10 +536,12 @@ on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): voi ### off8+ ### -off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void; +off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void 取消订阅服务状态变更通知,并通过callback方式返回,此方法为同步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -539,6 +570,8 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v 用于提供创建数据库的配置信息。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | createIfMissing | boolean | 否 | 当数据库文件不存在时是否创建数据库,默认创建。 | @@ -553,6 +586,8 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v 用于指定创建的数据库的类型。 +**系统能力**:以下各项对应的系统能力均为 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,23 @@ KVStore常量。 表示数据库模式,可以在创建或打开数据库时创建 Schema 对象并将它们放入 Options 中。 -### toJsonString8+ ### - -toJsonString():string; - -获取 json 格式的 schema 。 - -- 返回值: - -| 类型 | 说明 | -| ------------- | -------------- | -| string |以 json 格式返回Schema。 | - -- 示例 - - ``` - 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); - } - ``` +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 ## FieldNode8+ ## 表示 Schema 实例的节点,提供定义存储在数据库中的值的方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + ### appendChild8+ ### -appendChild(child: FieldNode): boolean; +appendChild(child: FieldNode): boolean 向这个 FieldNode 添加一个子节点。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -664,43 +684,22 @@ appendChild(child: FieldNode): boolean; ``` -### toJson8+ ### - -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); - } - ``` ## KvStoreResultSet8+ ## 提供获取KvStore数据库结果集的方法,提供查询和移动数据读取位置的方法,在调用KvStoreResultSet的方法前,需要先通过KvStore 构建一个KvStore 实例。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + ### getCount8+ ### -getCount(): number; +getCount(): number 获取结果集中的行数。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -729,10 +728,12 @@ getCount(): number; ### getPosition8+ ### -getPosition(): number; +getPosition(): number 获取结果集中当前的读取位置。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -761,10 +762,12 @@ getPosition(): number; ### moveToFirst8+ ### -moveToFirst(): boolean; +moveToFirst(): boolean 将读取位置移动到第一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -793,10 +796,12 @@ moveToFirst(): boolean; ### moveToLast8+ ### -moveToLast(): boolean; +moveToLast(): boolean 将读取位置移动到最后一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -825,10 +830,12 @@ moveToLast(): boolean; ### moveToNext8+ ### -moveToNext(): boolean; +moveToNext(): boolean 将读取位置移动到下一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -857,10 +864,12 @@ moveToNext(): boolean; ### moveToPrevious8+ ### -moveToPrevious(): boolean; +moveToPrevious(): boolean 将读取位置移动到上一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -889,10 +898,12 @@ moveToPrevious(): boolean; ### move8+ ### -move(offset: number): boolean; +move(offset: number): boolean 将读取位置移动到当前位置的相对偏移量。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -927,10 +938,12 @@ move(offset: number): boolean; ### moveToPosition8+ ### -moveToPosition(position: number): boolean; +moveToPosition(position: number): boolean 将读取位置从 0 移动到绝对位置。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -965,10 +978,12 @@ moveToPosition(position: number): boolean; ### isFirst8+ ### -isFirst(): boolean; +isFirst(): boolean 检查读取位置是否为第一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -997,10 +1012,12 @@ isFirst(): boolean; ### isLast8+ ### -isLast(): boolean; +isLast(): boolean 检查读取位置是否为最后一行。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1029,10 +1046,12 @@ isLast(): boolean; ### isBeforeFirst8+ ### -isBeforeFirst(): boolean; +isBeforeFirst(): boolean 检查读取位置是否在第一行之前。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1061,10 +1080,12 @@ isBeforeFirst(): boolean; ### isAfterLast8+ ### -isAfterLast(): boolean; +isAfterLast(): boolean 检查读取位置是否在最后一行之后。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1093,10 +1114,12 @@ isAfterLast(): boolean; ### getEntry8+ ### -getEntry(): Entry; +getEntry(): Entry 获取键值对 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1128,12 +1151,18 @@ getEntry(): Entry; 使用谓词表示数据库查询,提供创建Query实例、查询数据库中的数据和添加谓词的方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + + ### reset8+ ### -reset(): Query; +reset(): Query 公共查询重置。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + + - 返回值: | 类型 | 说明 | @@ -1162,6 +1191,8 @@ equalTo(field: string, value: number|string|boolean): Query; 构造一个Query对象来查询具有指定字段的条目,其值等于指定的值。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1191,10 +1222,12 @@ equalTo(field: string, value: number|string|boolean): Query; ### notEqualTo8+ ### -notEqualTo(field: string, value: number|string|boolean): Query; +notEqualTo(field: string, value: number|string|boolean): Query 构造一个Query对象以查询具有指定字段且值不等于指定值的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1224,10 +1257,12 @@ notEqualTo(field: string, value: number|string|boolean): Query; ### greaterThan8+ ### -greaterThan(field: string, value: number|string|boolean): Query; +greaterThan(field: string, value: number|string|boolean): Query 构造一个Query对象以查询具有大于指定值的指定字段的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1257,10 +1292,12 @@ greaterThan(field: string, value: number|string|boolean): Query; ### lessThan8+ ### -lessThan(field: string, value: number|string): Query; +lessThan(field: string, value: number|string): Query 构造一个Query对象以查询具有小于指定值的指定字段的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1290,10 +1327,12 @@ lessThan(field: string, value: number|string): Query; ### greaterThanOrEqualTo8+ ### -greaterThanOrEqualTo(field: string, value: number|string): Query; +greaterThanOrEqualTo(field: string, value: number|string): Query 构造一个Query对象以查询具有指定字段且值大于或等于指定值的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1323,10 +1362,12 @@ greaterThanOrEqualTo(field: string, value: number|string): Query; ### lessThanOrEqualTo8+ ### -lessThanOrEqualTo(field: string, value: number|string): Query; +lessThanOrEqualTo(field: string, value: number|string): Query 构造一个Query对象以查询具有指定字段且值小于或等于指定值的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1356,10 +1397,13 @@ lessThanOrEqualTo(field: string, value: number|string): Query; ### isNull8+ ### -isNull(field: string): Query; +isNull(field: string): Query 构造一个Query对象以查询具有值为null的指定字段的条目。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1388,10 +1432,13 @@ isNull(field: string): Query; ### inNumber8+ ### -inNumber(field: string, valueList: number[]): Query; +inNumber(field: string, valueList: number[]): Query 构造一个Query对象以查询具有指定字段的条目,其值在指定的值列表中。 + +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1422,10 +1469,12 @@ inNumber(field: string, valueList: number[]): Query; ### inString8+ ### -inString(field: string, valueList: string[]): Query; +inString(field: string, valueList: string[]): Query 构造一个Query对象以查询具有指定字段的条目,其值在指定的字符串值列表中。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1455,10 +1504,12 @@ inString(field: string, valueList: string[]): Query; ### notInNumber8+ ### -notInNumber(field: string, valueList: number[]): Query; +notInNumber(field: string, valueList: number[]): Query 构造一个Query对象以查询具有指定字段的条目,该字段的值不在指定的值列表中。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1488,10 +1539,12 @@ notInNumber(field: string, valueList: number[]): Query; ### notInString8+ ### -notInString(field: string, valueList: string[]): Query; +notInString(field: string, valueList: string[]): Query 构造一个Query对象以查询具有指定字段且值不在指定字符串值列表中的条目。 + + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1521,10 +1574,12 @@ notInString(field: string, valueList: string[]): Query; ### like8+ ### -like(field: string, value: string): Query; +like(field: string, value: string): Query 构造一个Query对象以查询具有与指定字符串值相似的指定字段的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1554,10 +1609,12 @@ like(field: string, value: string): Query; ### unlike8+ ### -unlike(field: string, value: string): Query; +unlike(field: string, value: string): Query 构造一个Query对象以查询具有与指定字符串值不相似的指定字段的条目。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1587,10 +1644,12 @@ unlike(field: string, value: string): Query; ### and8+ ### -and(): Query; +and(): Query 构造一个带有与条件的查询对象。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1615,10 +1674,12 @@ and(): Query; ### or8+ ### -or(): Query; +or(): Query 构造一个带有或条件的Query对象。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1643,10 +1704,12 @@ or(): Query; ### orderByAsc8+ ### -orderByAsc(field: string): Query; +orderByAsc(field: string): Query 构造一个Query对象,将查询结果按升序排序。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1676,10 +1739,12 @@ orderByAsc(field: string): Query; ### orderByDesc8+ ### -orderByDesc(field: string): Query; +orderByDesc(field: string): Query 构造一个Query对象,将查询结果按降序排序。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1710,10 +1775,12 @@ orderByDesc(field: string): Query; ### limit8+ ### -limit(total: number, offset: number): Query; +limit(total: number, offset: number): Query 构造一个Query对象来指定结果的数量和开始位置。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1744,10 +1811,12 @@ limit(total: number, offset: number): Query; ### isNotNull8+ ### -isNotNull(field: string): Query; +isNotNull(field: string): Query 使用不为空的指定字段创建查询条件。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1776,10 +1845,12 @@ isNotNull(field: string): Query; ### beginGroup8+ ### -beginGroup(): Query; +beginGroup(): Query 创建一个带有左括号的查询条件组。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1804,10 +1875,12 @@ beginGroup(): Query; ### endGroup8+ ### -endGroup(): Query; +endGroup(): Query 创建一个带有右括号的查询条件组。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1832,10 +1905,12 @@ endGroup(): Query; ### prefixKey8+ ### -prefixKey(prefix: string): Query; +prefixKey(prefix: string): Query 创建具有指定键前缀的查询条件。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1865,10 +1940,12 @@ prefixKey(prefix: string): Query; ### setSuggestIndex8+ ### -setSuggestIndex(index: string): Query; +setSuggestIndex(index: string): Query 设置一个指定的索引,将优先用于查询。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1898,10 +1975,12 @@ setSuggestIndex(index: string): Query; ### deviceId8+ ### -deviceId(deviceId:string):Query; +deviceId(deviceId:string):Query 添加设备ID作为key的前缀。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -1930,10 +2009,12 @@ deviceId(deviceId:string):Query; ### getSqlLike8+ ### -getSqlLike():string; +getSqlLike():string 获取指定Query对象的查询语句。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -1957,12 +2038,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 +2082,8 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise<void 添加指定类型键值对到数据库,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2035,6 +2122,8 @@ delete(key: string, callback: AsyncCallback<void>): void 从数据库中删除指定键值的数据,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2075,6 +2164,8 @@ delete(key: string): Promise<void> 从数据库中删除指定键值的数据,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2116,6 +2207,8 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific 订阅指定类型的数据变更通知,此方法为同步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2137,16 +2230,18 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific ### on -on(event: 'syncComplete', syncCallback: Callback8+ -off(event:'dataChange', observer?: Callback<ChangeNotification>): void; +off(event:'dataChange', observer?: Callback<ChangeNotification>): void 取消订阅数据变更通知,此方法为同步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2186,10 +2283,12 @@ off(event:'dataChange', observer?: Callback<ChangeNotification>): void; ### putBatch8+ -putBatch(entries: Entry[], callback: AsyncCallback<void>): void; +putBatch(entries: Entry[], callback: AsyncCallback<void>): void 批量插入键值对到KvStore数据库中,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2232,10 +2331,12 @@ putBatch(entries: Entry[], callback: AsyncCallback<void>): void; ### putBatch8+ -putBatch(entries: Entry[]): Promise<void>; +putBatch(entries: Entry[]): Promise<void> 批量插入键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2285,10 +2386,12 @@ putBatch(entries: Entry[]): Promise<void>; ### deleteBatch8+ -deleteBatch(keys: string[], callback: AsyncCallback<void>): void; +deleteBatch(keys: string[], callback: AsyncCallback<void>): void 批量删除KvStore数据库中的键值对,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2330,10 +2433,12 @@ deleteBatch(keys: string[], callback: AsyncCallback<void>): void; ### deleteBatch8+ ### -deleteBatch(keys: string[]): Promise<void>; +deleteBatch(keys: string[]): Promise<void> 批量删除键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2384,10 +2489,12 @@ deleteBatch(keys: string[]): Promise<void>; ### startTransaction8+ ### -startTransaction(callback: AsyncCallback<void>): void; +startTransaction(callback: AsyncCallback<void>): void 启动KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2434,10 +2541,12 @@ startTransaction(callback: AsyncCallback<void>): void; ### startTransaction8+ ### -startTransaction(): Promise<void>; +startTransaction(): Promise<void> 启动KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -2467,10 +2576,12 @@ startTransaction(): Promise<void>; ### commit8+ ### -commit(callback: AsyncCallback<void>): void; +commit(callback: AsyncCallback<void>): void 提交KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2497,10 +2608,12 @@ commit(callback: AsyncCallback<void>): void; ### commit8+ ### -commit(): Promise<void>; +commit(): Promise<void> 提交KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -2525,10 +2638,12 @@ commit(): Promise<void>; ### rollback8+ ### -rollback(callback: AsyncCallback<void>): void; +rollback(callback: AsyncCallback<void>): void 在KvStore数据库中回滚事务,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2555,10 +2670,12 @@ rollback(callback: AsyncCallback<void>): void; ### rollback8+ ### -rollback(): Promise<void>; +rollback(): Promise<void> 在KvStore数据库中回滚事务,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -2583,10 +2700,12 @@ rollback(): Promise<void>; ### enableSync8+ ### -enableSync(enabled: boolean, callback: AsyncCallback<void>): void; +enableSync(enabled: boolean, callback: AsyncCallback<void>): void 设定是否开启同步,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2614,10 +2733,12 @@ enableSync(enabled: boolean, callback: AsyncCallback<void>): void; ### enableSync8+ ### -enableSync(enabled: boolean): Promise<void>; +enableSync(enabled: boolean): Promise<void> 设定是否开启同步,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2648,10 +2769,12 @@ enableSync(enabled: boolean): Promise<void>; ### setSyncRange8+ ### -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 +2801,12 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: Asy ### setSyncRange8+ ### -setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>; +setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void> 设置同步范围标签,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2718,6 +2843,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v 描述订阅类型。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 名称 | 默认值 | 说明 | | ----- | ------ | ----------------------- | | SUBSCRIBE_TYPE_LOCAL |0 |表示订阅本地数据变更。 | @@ -2728,6 +2855,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v 数据变更时通知的对象,包括数据插入的数据、更新的数据、删除的数据和设备ID。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 名称 | 参数类型 |可读 |可写 | 说明 | | ----- | ------- | -----| ------|------------------------ | | insertEntries | [Entry](#entry)[] | 是 | 是 |数据添加记录。 | @@ -2739,6 +2868,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v 存储在数据库中的键值对。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 名称 | 参数类型 |可读 |可写 | 说明 | | ----- | ------- | -----| ------|------------------------ | | key | string | 是 | 是 |键值。 | @@ -2749,6 +2880,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v 存储在数据库中的对象。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 名称 | 参数类型 |可读 |可写 | 说明 | | ----- | ------- | -----| ------|------------------------ | | type | [ValueType](#value) | 是 | 是 |值类型。 | @@ -2760,6 +2893,8 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v 只能被内部应用使用。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + | 名称 | 默认值 | 说明 | | ----- | ------ | ----------------------- | | STRING |0 |表示值类型为字符串。 | @@ -2773,12 +2908,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 +2950,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 +2994,12 @@ get(key: string): Promise<Uint8Array | string | boolean | number> ### getEntries8+ ### -getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void; +getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void 获取匹配指定键前缀的所有键值对,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2897,10 +3040,12 @@ getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void; ### getEntries8+ ### -getEntries(keyPrefix: string): Promise<Entry[]>; +getEntries(keyPrefix: string): Promise<Entry[]> 获取匹配指定键前缀的所有键值对,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -2953,10 +3098,12 @@ getEntries(keyPrefix: string): Promise<Entry[]>; ### getEntries8+ ### -getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; +getEntries(query: Query, callback: AsyncCallback<Entry[]>): void 获取与指定 Query 对象匹配的键值对列表,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3002,10 +3149,12 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; ### getEntries8+ ### -getEntries(query: Query): Promise<Entry[]>; +getEntries(query: Query): Promise<Entry[]> 获取匹配指定键前缀的所有键值对,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3057,10 +3206,12 @@ getEntries(query: Query): Promise<Entry[]>; ### getResultSet8+ ### -getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void; +getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void 从 KvStore 数据库中获取具有指定前缀的结果集,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3104,10 +3255,12 @@ getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>) ### getResultSet8+ ### -getResultSet(keyPrefix: string): Promise<KvStoreResultSet>; +getResultSet(keyPrefix: string): Promise<KvStoreResultSet> 从 KvStore 数据库中获取具有指定前缀的结果集,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3162,10 +3315,12 @@ getResultSet(keyPrefix: string): Promise<KvStoreResultSet>; ### getResultSet8+ ### -getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void; +getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void 获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3208,10 +3363,12 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi ### getResultSet8+ ### -getResultSet(query: Query): Promise<KvStoreResultSet>; +getResultSet(query: Query): Promise<KvStoreResultSet> 获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3262,10 +3419,12 @@ getResultSet(query: Query): Promise<KvStoreResultSet>; ### closeResultSet8+ ### -closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void; +closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void 关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3294,10 +3453,12 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>) ### closeResultSet8+ ### -closeResultSet(resultSet: KvStoreResultSet): Promise<void>; +closeResultSet(resultSet: KvStoreResultSet): Promise<void> 关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3329,10 +3490,12 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void>; ### getResultSize8+ ### -getResultSize(query: Query, callback: AsyncCallback<number>): void; +getResultSize(query: Query, callback: AsyncCallback<number>): void 获取与指定 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3373,10 +3536,12 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void; ### getResultSize8+ ### -getResultSize(query: Query): Promise<number>; +getResultSize(query: Query): Promise<number> 获取与指定 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3426,10 +3591,12 @@ getResultSize(query: Query): Promise<number>; ### removeDeviceData8+ ### -removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; +removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void 删除指定设备的数据,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3466,10 +3633,12 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; ### removeDeviceData8+ ### -removeDeviceData(deviceId: string): Promise<void>; +removeDeviceData(deviceId: string): Promise<void> 删除指定设备的数据,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3513,16 +3682,18 @@ removeDeviceData(deviceId: string): Promise<void>; ### on8+ ### -on(event: 'syncComplete', syncCallback: Callback8+ ### -off(event: 'syncComplete', syncCallback?: Callback8+ ### -setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void; +setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void 设置允许数据库同步的默认延迟,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3627,10 +3804,12 @@ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>) ### setSyncParam8+ ### -setSyncParam(defaultAllowedDelayMs: number): Promise<void>; +setSyncParam(defaultAllowedDelayMs: number): Promise<void> 设置允许数据库同步的默认延迟,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3663,10 +3842,12 @@ setSyncParam(defaultAllowedDelayMs: number): Promise<void>; ### getSecurityLevel8+ ### -getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void; +getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void 获取数据库的安全级别,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3689,10 +3870,12 @@ getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void; ### getSecurityLevel8+ ### -getSecurityLevel(): Promise<SecurityLevel>; +getSecurityLevel(): Promise<SecurityLevel> 获取数据库的安全级别,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 返回值: | 类型 | 说明 | @@ -3720,12 +3903,16 @@ getSecurityLevel(): Promise<SecurityLevel>; 在分布式系统中按设备管理分布式数据,继承自KvStore,提供查询数据和同步数据的方法。在调用DeviceKVStore的方法前,需要先通过getKVStore构建一个DeviceKVStore实例。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + ### get8+ ### -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 +3943,12 @@ get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|num ### get8+ ### -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 +3987,12 @@ get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array& ### getEntries8+ ### -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 +4035,12 @@ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry ### getEntries8+ ### -getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>; +getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]> 获取与指定设备 ID 和 key 前缀匹配的所有键值对,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3901,10 +4094,12 @@ getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>; ### getEntries8+ ### -getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; +getEntries(query: Query, callback: AsyncCallback<Entry[]>): void 获取与指定 Query 对象匹配的键值对列表,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -3952,10 +4147,12 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; ### getEntries8+ ### -getEntries(query: Query): Promise<Entry[]>; +getEntries(query: Query): Promise<Entry[]> 获取与指定 Query 对象匹配的键值对列表,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4008,10 +4205,12 @@ getEntries(query: Query): Promise<Entry[]>; ### getEntries8+ ### -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 +4259,12 @@ getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]> ### getEntries8+ ### -getEntries(deviceId: string, query: Query): Promise<Entry[]>; +getEntries(deviceId: string, query: Query): Promise<Entry[]> 获取与指定设备 ID 和 Query 对象匹配的键值对列表,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4118,10 +4319,12 @@ getEntries(deviceId: string, query: Query): Promise<Entry[]>; ### getResultSet8+ ### -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 +4354,12 @@ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvS ### getResultSet8+ ### -getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet>; +getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet> 获取与指定设备 ID 和 key 前缀匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4193,10 +4398,12 @@ getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet&g ### getResultSet8+ ### -getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void; +getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void 获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4243,10 +4450,12 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi ### getResultSet8+ ### -getResultSet(query: Query): Promise<KvStoreResultSet>; +getResultSet(query: Query): Promise<KvStoreResultSet> 获取与指定 Query 对象匹配的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4305,10 +4514,12 @@ getResultSet(query: Query): Promise<KvStoreResultSet>; ### getResultSet8+ ### -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 +4566,12 @@ getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreR ### getResultSet8+ ### -getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>; +getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet> 获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4419,10 +4632,12 @@ getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>; ### closeResultSet8+ ### -closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void; +closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void 关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4452,10 +4667,12 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>) ### closeResultSet8+ ### -closeResultSet(resultSet: KvStoreResultSet): Promise<void>; +closeResultSet(resultSet: KvStoreResultSet): Promise<void> 关闭由 getResultSet 返回的 KvStoreResultSet 对象,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4488,10 +4705,12 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void>; ### getResultSize8+ ### -getResultSize(query: Query, callback: AsyncCallback<number>): void; +getResultSize(query: Query, callback: AsyncCallback<number>): void 获取与指定 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4533,10 +4752,12 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void; ### getResultSize8+ ### -getResultSize(query: Query): Promise<number>; +getResultSize(query: Query): Promise<number> 获取与指定 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4591,6 +4812,8 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number& 获取与指定设备 ID 和 Query 对象匹配的结果数,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4632,10 +4855,12 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number& ### getResultSize8+ ### -getResultSize(deviceId: string, query: Query): Promise<number>; +getResultSize(deviceId: string, query: Query): Promise<number> 获取与指定设备 ID 和 Query 对象匹配的结果数,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4686,10 +4911,12 @@ getResultSize(deviceId: string, query: Query): Promise<number>; ### removeDeviceData8+ ### -removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; +removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void 从当前数据库中删除指定设备的数据,并通过callback方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4726,10 +4953,12 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; ### removeDeviceData8+ ### -removeDeviceData(deviceId: string): Promise<void>; +removeDeviceData(deviceId: string): Promise<void> 从当前数据库中删除指定设备的数据,并通过Promise方式返回,此方法为异步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4773,10 +5002,12 @@ removeDeviceData(deviceId: string): Promise<void>; ### sync8+ ### -sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; +sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void 在手动模式下,触发数据库同步,此方法为同步方法。 +**系统能力**:以下各项对应的系统能力均为 SystemCapability.DistributedDataManager.KVStore.Core。 + - 参数: | 参数名 | 参数类型 | 必填 | 说明 | @@ -4809,10 +5040,12 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; ### on8+ ### -on(event: 'syncComplete', syncCallback: Callback8+ ### -off(event: 'syncComplete', syncCallback?: Callback