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