openharmony 鸿蒙 js-apis-data-commonType

2025-06-12 浏览 (1)

@ohos.data.commonType (Common Data Types)

The commonType module defines common data types in data management.

NOTE

The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { commonType } from '@kit.ArkData';

AssetStatus

Enumerates the asset statuses. Use the enum name rather than the enum value.

System capability: SystemCapability.DistributedDataManager.CommonType

NameValueDescription
ASSET_NORMAL1The asset is in normal status.
ASSET_INSERT2The asset is to be inserted to the cloud.
ASSET_UPDATE3The asset is to be updated to the cloud.
ASSET_DELETE4The asset is to be deleted from the cloud.
ASSET_ABNORMAL5The asset is in abnormal status.
ASSET_DOWNLOADING6The asset is being downloaded to a local device.

Asset

Represents asset (such as a file, image, or video) information. For details, see the sample code in Using Distributed Data Objects in Cross-Device Migration.

System capability: SystemCapability.DistributedDataManager.CommonType

NameTypeMandatoryDescription
namestringYesAsset name.
uristringYesAsset URI, which is an absolute path in the system.
pathstringYesApplication sandbox path of the asset.
createTimestringYesTime when the asset was created.
modifyTimestringYesTime when the asset was last modified.
sizestringYesSize of the asset.
statusAssetStatusNoAsset status. The default value is ASSET_NORMAL.

Assets

type Assets = Array<Asset>

Represents an array of Assets.

System capability: SystemCapability.DistributedDataManager.CommonType

TypeDescription
Array<Asset>Array of assets.

ValueType

type ValueType = null|number|string|boolean|Uint8Array|Asset|Assets

Enumerates the value types, which vary with the parameter function.

System capability: SystemCapability.DistributedDataManager.CommonType

TypeDescription
nullThe value is null.
numberThe value is a number.
stringThe value is a string.
booleanThe value is true or false.
Uint8ArrayThe value is a Uint8 array.
AssetThe value is an Asset.
AssetsThe value is an Asset array.

ValuesBucket

type ValuesBucket = Record<string, ValueType>

Defines the types of the key and value in a KV pair. This type is not multi-thread safe. If a ValuesBucket instance is operated by multiple threads at the same time in an application, use a lock for the instance.

System capability: SystemCapability.DistributedDataManager.CommonType

TypeDescription
Record<string, ValueType>Types of the key and value in a KV pair. The key type is string, and the value type is ValueType.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkData (ArkData Management)

harmony 鸿蒙Data

harmony 鸿蒙OH_Cursor

harmony 鸿蒙OH_Predicates

harmony 鸿蒙OH_Rdb_Config

harmony 鸿蒙OH_Rdb_Store

harmony 鸿蒙OH_VBucket

harmony 鸿蒙OH_VObject

harmony 鸿蒙Preferences

harmony 鸿蒙_r_d_b

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/4G6UvX