harmony 鸿蒙@ohos.data.commonType (Common Data Types)

  • 2025-06-12
  • 浏览 (4)

@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

Name Value Description
ASSET_NORMAL 1 The asset is in normal status.
ASSET_INSERT 2 The asset is to be inserted to the cloud.
ASSET_UPDATE 3 The asset is to be updated to the cloud.
ASSET_DELETE 4 The asset is to be deleted from the cloud.
ASSET_ABNORMAL 5 The asset is in abnormal status.
ASSET_DOWNLOADING 6 The 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

Name Type Mandatory Description
name string Yes Asset name.
uri string Yes Asset URI, which is an absolute path in the system.
path string Yes Application sandbox path of the asset.
createTime string Yes Time when the asset was created.
modifyTime string Yes Time when the asset was last modified.
size string Yes Size of the asset.
status AssetStatus No Asset status. The default value is ASSET_NORMAL.

Assets

type Assets = Array<Asset>

Represents an array of Assets.

System capability: SystemCapability.DistributedDataManager.CommonType

Type Description
Array&lt;Asset&gt; 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

Type Description
null The value is null.
number The value is a number.
string The value is a string.
boolean The value is true or false.
Uint8Array The value is a Uint8 array.
Asset The value is an Asset.
Assets The value is an Asset array.

ValuesBucket

type ValuesBucket = Record

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

Type Description
Record 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

0  赞