• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #ifndef OH_DATA_DEFINE_H
17 #define OH_DATA_DEFINE_H
18 
19 #include <vector>
20 #include "value_object.h"
21 #include "oh_values_bucket.h"
22 #include "transaction.h"
23 #include "oh_predicates.h"
24 #include "oh_rdb_transaction.h"
25 
26 struct OH_Rdb_Transaction {
27     static constexpr int64_t OH_RDB_TRANS_ID = 0x10000000;
28     int64_t id = OH_RDB_TRANS_ID;
29 
30     std::shared_ptr<OHOS::NativeRdb::Transaction> trans_;
31     bool IsValid() const;
32 };
33 
34 struct OH_RDB_TransOptions {
35     static constexpr int64_t OH_TRANS_OPTION_ID = 0x10001000;
36     int64_t id = OH_TRANS_OPTION_ID;
37 
38     OH_RDB_TransType type_;
39     bool IsValid() const;
40 };
41 
42 struct OH_Data_Value {
43     static constexpr int64_t OH_VALUE_ID = 0x10002000;
44     int64_t id = OH_VALUE_ID;
45 
46     OHOS::NativeRdb::ValueObject value_;
47     bool IsValid() const;
48 };
49 
50 struct OH_Data_Values {
51     static constexpr int64_t OH_VALUES_ID = 0x10003000;
52     int64_t id = OH_VALUES_ID;
53 
54     std::vector<OH_Data_Value> values_;
55     bool IsValid() const;
56 };
57 
58 struct OH_Data_VBuckets {
59     static constexpr int64_t OH_VBUCKETS_ID = 0x10004000;
60     int64_t id = OH_VBUCKETS_ID;
61 
62     std::vector<OH_VBucket *> rows_;
63     bool IsValid() const;
64 };
65 #endif
66