• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.data.ValuesBucket (Data Set)
2
3The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a 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 } from '@ohos.data.ValuesBucket';
16import { ValuesBucket } from '@ohos.data.ValuesBucket';
17```
18
19## ValueType
20
21Enumerates the value types allowed by the database.
22
23**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
24
25| Type   | Description                |
26| ------- | -------------------- |
27| number  | The value is a number.  |
28| string  | The value is a string.|
29| boolean | The value is of Boolean type.|
30
31## ValuesBucket
32
33Defines 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.
34
35**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
36
37| Key Type         | Value Type                                     |
38| ------------- | --------------------------------------------- |
39|  string | [ValueType](#valuetype)\| Uint8Array \| null |
40