• 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 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9
10
11## Modules to Import
12
13```ts
14import { ValueType } from '@ohos.data.ValuesBucket';
15import { ValuesBucket } from '@ohos.data.ValuesBucket';
16```
17
18## ValueType
19
20Enumerates the value types allowed by the database.
21
22**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
23
24| Type   | Description                |
25| ------- | -------------------- |
26| number  | The value is a number.  |
27| string  | The value is a string.|
28| boolean | The value is of Boolean type.|
29
30## ValuesBucket
31
32Defines 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.
33
34**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
35
36| Key Type         | Value Type                                     |
37| ------------- | --------------------------------------------- |
38|  string | [ValueType](#valuetype)\| Uint8Array \| null |
39