• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.data.ValuesBucket (Data Set)
2
3**ValuesBucket** is a dataset in the form of key-value (KV) pairs that can be inserted in the database.
4
5> **NOTE**
6>
7> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9> - The APIs of this module can be used only in the stage model.
10
11
12## Modules to Import
13
14```ts
15import { ValueType, ValuesBucket } from '@kit.ArkData';
16```
17
18## ValueType
19
20type ValueType = number | string | boolean
21
22Defines the value types allowed in a **ValuesBucket** instance.
23
24**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
25
26| Type   | Description                |
27| ------- | -------------------- |
28| number  | The value is a number.  |
29| string  | The value is a string.|
30| boolean | The value is **true** or **false**.|
31
32## ValuesBucket
33
34type ValuesBucket = Record<string, ValueType | Uint8Array | null>
35
36Defines 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 it.
37
38**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
39
40| Type         | Description                                     |
41| ------------- | --------------------------------------------- |
42| Record<string, [ValueType](#valuetype) \| Uint8Array \| null> | Types of the key and value in a KV pair. The key type is string, and the value type can be [ValueType](#valuetype), Uint8Array, or null. |
43