From fe1f448f1bf543a54920cacf370de16877bacad6 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Mon, 1 Aug 2022 10:56:18 +0800 Subject: [PATCH] update docs Signed-off-by: Annie_wang --- .../reference/apis/js-apis-data-ability.md | 4 +- .../reference/apis/js-apis-data-rdb.md | 12 +- .../reference/apis/js-apis-data-storage.md | 258 +++++++++--------- 3 files changed, 137 insertions(+), 137 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-data-ability.md b/en/application-dev/reference/apis/js-apis-data-ability.md index 155b783ab4..e411ed212e 100644 --- a/en/application-dev/reference/apis/js-apis-data-ability.md +++ b/en/application-dev/reference/apis/js-apis-data-ability.md @@ -394,7 +394,7 @@ Sets a **DataAbilityPredicates** object to match the specified string. between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates -Sets a **DataAbilityPredicates** object to match the field with data type **ValueType** and value within the specified range. +Sets a **DataAbilityPredicates** object to match a field with data type **ValueType** and value within the specified range. **System capability**: SystemCapability.DistributedDataManager.DataShare.Core @@ -789,7 +789,7 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.DataShare.Core -| Name | Description | +| Type | Description | | ------- | -------------------- | | number | The value is a number. | | string | The value is a string. | diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md index bee9c34864..4c2ca88c54 100644 --- a/en/application-dev/reference/apis/js-apis-data-rdb.md +++ b/en/application-dev/reference/apis/js-apis-data-rdb.md @@ -1038,7 +1038,7 @@ Updates data in the database based on the specified RdbPredicates object. This A | -------- | -------- | -------- | -------- | | values | [ValuesBucket](#valuesbucket) | Yes| Data to update. The value specifies the row of data to be updated in the database. The key-value pair is associated with the column name in the target table.| | rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Row of data to insert.| -| callback | AsyncCallback<number> | Yes| Callback used to return the number of rows updated.| +| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.| **Example** ```js @@ -1682,7 +1682,7 @@ Defines the data types allowed. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core -| Name| Description| +| Type| Description| | -------- | -------- | | number | Number.| | string | String.| @@ -1691,13 +1691,13 @@ Defines the data types allowed. ## ValuesBucket -Defines a bucket to store key-value pairs. +Defines the types of the key and value in a KV pair. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes| Defines a bucket to store key-value pairs.| +| Key Type| Value Type| +| -------- | -------- | +| string | [ValueType](#valuetype)\| Uint8Array \| null | ## SyncMode8+ diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index 923d643c97..5f2a2db1ba 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -3,11 +3,11 @@ Lightweight storage provides applications with data processing capability and allows applications to perform lightweight data storage and query. Data is stored in key-value (KV) pairs. Keys are of the string type, and values can be of the number, string, or Boolean type. -> **NOTE** +> **NOTE**
> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> + + ## Modules to Import @@ -35,14 +35,14 @@ Reads the specified file and loads its data to the **Storage** instance for data **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Return value** -| Type| Description| -| -------- | -------- | -| [Storage](#storage) | **Storage** instance used for data storage operations.| + | Type| Description| + | -------- | -------- | + | [Storage](#storage) | **Storage** instance used for data storage operations.| **Example** ```js @@ -65,10 +65,10 @@ Reads the specified file and loads its data to the **Storage** instance for data **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| -| callback | AsyncCallback<[Storage](#storage)> | Yes| Callback used to return the execution result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| + | callback | AsyncCallback<[Storage](#storage)> | Yes| Callback used to return the execution result.| **Example** ```js @@ -95,14 +95,14 @@ Reads the specified file and loads its data to the **Storage** instance for data **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[Storage](#storage)> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<[Storage](#storage)> | Promise used to return the result.| **Example** ```js @@ -129,9 +129,9 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Example** ```js @@ -149,10 +149,10 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -176,14 +176,14 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -206,9 +206,9 @@ Removes the singleton **Storage** instance of a file from the cache. The removed **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Example** ```js @@ -226,10 +226,10 @@ Removes the singleton **Storage** instance of a file from the cache. The removed **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -253,14 +253,14 @@ Removes the singleton **Storage** instance of a file from the cache. The removed **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| path | string | Yes| Path of the target file.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | path | string | Yes| Path of the target file.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -288,15 +288,15 @@ Obtains the value corresponding to a key. If the value is null or not in the def **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| defValue | [ValueType](#valuetype) | Yes| Default value to be returned if the value of the specified key does not exist. It can be a number, string, or Boolean value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | defValue | [ValueType](#valuetype) | Yes| Default value to be returned if the value of the specified key does not exist. It can be a number, string, or Boolean value.| **Return value** -| Type| Description| -| -------- | -------- | -| ValueType | Value corresponding to the specified key. If the value is null or not in the default value format, the default value is returned.| + | Type| Description| + | -------- | -------- | + | ValueType | Value corresponding to the specified key. If the value is null or not in the default value format, the default value is returned.| **Example** ```js @@ -314,11 +314,11 @@ Obtains the value corresponding to a key. If the value is null or not in the def **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, string, or Boolean value.| -| callback | AsyncCallback<ValueType> | Yes| Callback used to return the execution result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, string, or Boolean value.| + | callback | AsyncCallback<ValueType> | Yes| Callback used to return the execution result.| **Example** ```js @@ -348,9 +348,9 @@ Obtains the value corresponding to a key. If the value is null or not in the def | defValue | [ValueType](#valuetype) | Yes| Default value to be returned. It can be a number, string, or Boolean value.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<ValueType> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<ValueType> | Promise used to return the result.| **Example** ```js @@ -372,10 +372,10 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| **Example** ```js @@ -392,11 +392,11 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -419,15 +419,15 @@ Obtains the **Storage** instance corresponding to the specified file, writes dat **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | value | [ValueType](#valuetype) | Yes| New value to store. It can be a number, string, or Boolean value.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -449,14 +449,14 @@ Checks whether the storage object contains data with a given key. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| **Return value** -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the storage object contains data with the specified key; returns **false** otherwise.| + | Type| Description| + | -------- | -------- | + | boolean | Returns **true** if the storage object contains data with the specified key; returns **false** otherwise.| **Example** ```js @@ -476,15 +476,15 @@ Checks whether the storage object contains data with a given key. This API uses **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| callback | AsyncCallback<boolean> | Yes| Callback used to return the execution result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the execution result.| **Return value** -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the storage object contains data with the specified key; returns **false** otherwise.| + | Type| Description| + | -------- | -------- | + | boolean | Returns **true** if the storage object contains data with the specified key; returns **false** otherwise.| **Example** ```js @@ -509,14 +509,14 @@ Checks whether the storage object contains data with a given key. This API uses **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result.| **Example** ```js @@ -540,9 +540,9 @@ Deletes data with the specified key from this storage object. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| **Example** ```js @@ -559,10 +559,10 @@ Deletes data with the specified key from this storage object. This API uses an a **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data. It cannot be empty.| -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data. It cannot be empty.| + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -585,14 +585,14 @@ Deletes data with the specified key from this storage object. This API uses a pr **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| key | string | Yes| Key of the data.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | key | string | Yes| Key of the data.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -628,9 +628,9 @@ Saves the modification of this object to the **Storage** instance and synchroniz **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -653,9 +653,9 @@ Saves the modification of this object to the **Storage** instance and synchroniz **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -691,9 +691,9 @@ Clears this **Storage** object. This API uses an asynchronous callback to return **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback that returns no value.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback that returns no value.| **Example** ```js @@ -716,9 +716,9 @@ Clears this **Storage** object. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise that returns no value.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise that returns no value.| **Example** ```js @@ -740,10 +740,10 @@ Subscribes to data changes. The **StorageObserver** needs to be implemented. Whe **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Description| -| -------- | -------- | -------- | -| type | string | Event type. The value **change** indicates data change events.| -| callback | Callback<[StorageObserver](#storageobserver)> | Callback used to return data changes.| + | Name| Type| Description| + | -------- | -------- | -------- | + | type | string | Event type. The value **change** indicates data change events.| + | callback | Callback<[StorageObserver](#storageobserver)> | Callback used to return data changes.| **Example** ```js @@ -765,10 +765,10 @@ Unsubscribes from data changes. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core **Parameters** -| Name| Type| Description| -| -------- | -------- | -------- | -| type | string | Event type. The value **change** indicates data change events.| -| callback | Callback<[StorageObserver](#storageobserver)> | Callback used to return data changes.| + | Name| Type| Description| + | -------- | -------- | -------- | + | type | string | Event type. The value **change** indicates data change events.| + | callback | Callback<[StorageObserver](#storageobserver)> | Callback used to return data changes.| **Example** ```js @@ -793,7 +793,7 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core -| Name | Description | +| Type | Description | | ------- | -------------------- | | number | The value is a number. | | string | The value is a string. | -- GitLab