• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Types
2
3> **NOTE**
4>
5> 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.
6
7## Assets<sup>10+</sup>
8
9type Assets = Asset[]
10
11Indicates an [Asset](arkts-apis-data-relationalStore-i.md#asset10) array.
12
13**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
14
15| Type   | Description                |
16| ------- | -------------------- |
17| [Asset](arkts-apis-data-relationalStore-i.md#asset10)[] | Array of assets.  |
18
19## ValueType
20
21type ValueType = null | number | string | boolean | Uint8Array | Asset | Assets | Float32Array | bigint
22
23Defines the types of the value in a KV pair. The type varies with the parameter function.
24
25**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
26
27| Type   | Description                |
28| ------- | -------------------- |
29| null<sup>10+</sup>    | Null.  |
30| number  | Number.  |
31| string  | String. |
32| boolean | Boolean.|
33| Uint8Array<sup>10+</sup>           | Uint8 array.           |
34| Asset<sup>10+</sup>  | [Asset](arkts-apis-data-relationalStore-i.md#asset10).<br>If the value type is Asset, the type in the SQL statement for creating a table must be ASSET.|
35| Assets<sup>10+</sup> | [Assets](#assets10).<br>If the value type is Assets, the type in the SQL statement for creating a table must be ASSETS.|
36| Float32Array<sup>12+</sup> | Array of 32-bit floating-point numbers.<br>If the field type is Float32Array, the type in the SQL statement for creating a table must be floatvector(128).|
37| bigint<sup>12+</sup> | Integer of any length.<br>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](../../database/data-persistence-by-rdb-store.md).<br>**NOTE**<br>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**<br>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'.<br>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.|
38
39## ValuesBucket
40
41type ValuesBucket = Record<string, ValueType>
42
43Defines the data in the form of a KV pair. **ValuesBucket** cannot be passed across threads using Sendable.
44
45**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
46
47| Type             | Description                          |
48| ---------------- | ---------------------------- |
49| Record<string, [ValueType](#valuetype)> | Types of the key and value in a KV pair. The key type is string, and the value type is [ValueType](#valuetype).|
50
51## PRIKeyType<sup>10+</sup>
52
53type PRIKeyType = number | string
54
55Enumerates the types of the primary key in a row of a database table.
56
57**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
58
59| Type            | Description                              |
60| ---------------- | ---------------------------------- |
61| number | The primary key is a number.|
62| string | The primary key is a string.|
63
64## UTCTime<sup>10+</sup>
65
66type UTCTime = Date
67
68Represents the data type of the UTC time.
69
70**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
71
72| Type| Description           |
73| ---- | --------------- |
74| Date | UTC time.|
75
76## ModifyTime<sup>10+</sup>
77
78type ModifyTime = Map<PRIKeyType, UTCTime>
79
80Represents the data type of the primary key and modification time of a database table.
81
82**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
83
84| Type                                                   | Description                                                        |
85| ------------------------------------------------------- | ------------------------------------------------------------ |
86| Map<[PRIKeyType](#prikeytype10), [UTCTime](#utctime10)> | 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.|
87