9f3a45c6创建于 2025年12月19日历史提交

Types

NOTE

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

Assets10+

type Assets = Asset[]

Indicates an Asset array.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
Asset[] Array of assets.

ValueType

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

Defines the types of the value in a KV pair. The type varies with the parameter function.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
null10+ Null.
number Number.
string String.
boolean Boolean.
Uint8Array10+ Uint8 array.
Asset10+ Asset.
If the value type is Asset, the type in the SQL statement for creating a table must be ASSET.
Assets10+ Assets.
If the value type is Assets, the type in the SQL statement for creating a table must be ASSETS.
Float32Array12+ Array of 32-bit floating-point numbers.
If the field type is Float32Array, the type in the SQL statement for creating a table must be floatvector(128).
bigint12+ Integer of any length.
If the value type is bigint, the type in the SQL statement for creating a table must be UNLIMITED INT. For details, see Persisting RDB Store Data.
NOTE
The bigint type does not support value comparison and cannot be used with the following predicates: between, notBetween, greaterThan, lessThan, greaterThanOrEqualTo, lessThanOrEqualTo, orderByAsc, and orderByDesc
To write a value of bigint type, use BigInt() or add n to the end of the value, for example,'let data = BigInt(1234)' or 'let data = 1234n'.
If data of the number type is written to a bigint field, the type of the return value obtained (queried) is number but not bigint.

ValuesBucket

type ValuesBucket = Record<string, ValueType>

Defines the data in the form of a KV pair. ValuesBucket cannot be passed across threads using Sendable.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

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

PRIKeyType10+

type PRIKeyType = number | string

Enumerates the types of the primary key in a row of a database table.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
number The primary key is a number.
string The primary key is a string.

UTCTime10+

type UTCTime = Date

Represents the data type of the UTC time.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
Date UTC time.

ModifyTime10+

type ModifyTime = Map<PRIKeyType, UTCTime>

Represents the data type of the primary key and modification time of a database table.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
Map<PRIKeyType, UTCTime> The key is the primary key of a row in the database table, and the value is the last modification time of the row in UTC format.

RowData23+

type RowData = Array<ValueType>

Defines a row of data in a database table.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
Array<ValueType> Array of the types of ValueType.

RowsData23+

type RowsData = Array<RowData>

Defines multiple rows of data in a database table.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.DistributedDataManager.RelationalStore.Core

Type Description
Array<RowData> Array of the RowData types.