1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import featureAbility from '../@ohos.ability.featureAbility';
22import dataAbility from '../@ohos.data.dataAbility';
23import rdb from '../@ohos.data.rdb';
24
25/**
26 * Indicates an array of data operations that can contain several different operations on the database.
27 *
28 * @typedef DataAbilityOperation
29 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
30 * @since 7
31 */
32export interface DataAbilityOperation {
33  /**
34   * Indicates the path of data to operate.
35   *
36   * @type { string }
37   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
38   * @FAModelOnly
39   * @since 7
40   */
41  uri: string;
42
43  /**
44   * Indicates a operation type.
45   *
46   * @type { featureAbility.DataAbilityOperationType }
47   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
48   * @FAModelOnly
49   * @since 7
50   */
51  type: featureAbility.DataAbilityOperationType;
52
53  /**
54   * Indicates the data values to be set.
55   *
56   * @type { ?rdb.ValuesBucket }
57   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
58   * @FAModelOnly
59   * @since 7
60   */
61  valuesBucket?: rdb.ValuesBucket;
62
63  /**
64   * Indicates the valuesBucket object containing a set of key-value pairs.
65   *
66   * @type { ?rdb.ValuesBucket }
67   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
68   * @FAModelOnly
69   * @since 7
70   */
71  valueBackReferences?: rdb.ValuesBucket;
72
73  /**
74   * Indicates the filter criteria to set. If this parameter is null, all data records
75   * will be operated by default.
76   *
77   * @type { ?dataAbility.DataAbilityPredicates }
78   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
79   * @FAModelOnly
80   * @since 7
81   */
82  predicates?: dataAbility.DataAbilityPredicates;
83
84  /**
85   * Indicates the back reference to be used as a filter criterion in predicates.
86   *
87   * @type { ?Map<number, number> }
88   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
89   * @FAModelOnly
90   * @since 7
91   */
92  predicatesBackReferences?: Map<number, number>;
93
94  /**
95   * Specifies whether a batch operation can be interrupted.
96   *
97   * @type { ?boolean }
98   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
99   * @FAModelOnly
100   * @since 7
101   */
102  interrupted?: boolean;
103
104  /**
105   * Indicates the expected number of rows to update or delete.
106   *
107   * @type { ?number }
108   * @syscap SystemCapability.Ability.AbilityRuntime.FAModel
109   * @FAModelOnly
110   * @since 7
111   */
112  expectedCount?: number;
113}
114