harmony 鸿蒙Types

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

Types

说明:

本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

Assets10+

type Assets = Asset[]

表示Asset类型的数组。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
Asset[] 表示Asset类型的数组。

ValueType

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

用于表示允许的数据字段类型,接口参数具体类型根据其功能而定。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
null10+ 表示值类型为空。
number 表示值类型为数字。
string 表示值类型为字符串。
boolean 表示值类型为布尔值。
Uint8Array10+ 表示值类型为Uint8类型的数组。
Asset10+ 表示值类型为附件Asset
当字段类型是Asset时,在创建表的sql语句中,类型应当为:ASSET。
Assets10+ 表示值类型为附件数组Assets
当字段类型是Assets时,在创建表的sql语句中,类型应当为:ASSETS。
Float32Array12+ 表示值类型为浮点数组。
当字段类型是Float32Array时,在创建表的sql语句中,类型应当为:floatvector(128)。
bigint12+ 表示值类型为任意长度的整数。
当字段类型是bigint时,在创建表的sql语句中,类型应当为:UNLIMITED INT,详见通过关系型数据库实现数据持久化
说明: bigint类型当前不支持比较大小,不支持如下谓词:between、notBetween、greaterThanlessThan、greaterThanOrEqualTo、lessThanOrEqualTo、orderByAsc、orderByDesc。
bigint类型字段的数据写入时,需通过BigInt()方法或在数据尾部添加’n’的方式明确为bigint类型,如’let data = BigInt(1234)‘或’let data = 1234n’。
bigint字段如果写入number类型的数据,则查询该数据的返回类型为number,而非bigint。

ValuesBucket

type ValuesBucket = Record

用于存储键值对的类型。不支持Sendable跨线程传递。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
Record 表示键值对类型。键的类型为string,值的类型为ValueType

PRIKeyType10+

type PRIKeyType = number|string

用于表示数据库表某一行主键的数据类型。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
number 主键的类型可以是number。
string 主键的类型可以是string。

UTCTime10+

type UTCTime = Date

用于表示UTC类型时间的数据类型。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
Date UTC类型的时间。

ModifyTime10+

type ModifyTime = Map

用于存储数据库表的主键和修改时间的数据类型。

系统能力: SystemCapability.DistributedDataManager.RelationalStore.Core

类型 说明
Map<PRIKeyType, UTCTime> 键表示是数据库表某一行的主键,值表示该行的最后修改时间,用UTC格式表示。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkData(方舟数据管理)

harmony 鸿蒙Class (RdbPredicates)

harmony 鸿蒙arkts-apis-data-relationalStore-RdbStore

harmony 鸿蒙Interface (ResultSet)

harmony 鸿蒙Interface (Transaction)

harmony 鸿蒙Enums

harmony 鸿蒙Functions

harmony 鸿蒙Interfaces (其他)

harmony 鸿蒙模块描述

harmony 鸿蒙data_asset.h

0  赞