• 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 #include "rdb_store_config.h"
26 
27 struct OH_Rdb_Transaction {
28     static constexpr int64_t OH_RDB_TRANS_ID = 0x10000000;
29     int64_t id = OH_RDB_TRANS_ID;
30 
31     std::shared_ptr<OHOS::NativeRdb::Transaction> trans_;
32     bool IsValid() const;
33 };
34 
35 struct OH_RDB_TransOptions {
36     static constexpr int64_t OH_TRANS_OPTION_ID = 0x10001000;
37     int64_t id = OH_TRANS_OPTION_ID;
38 
39     OH_RDB_TransType type_;
40     bool IsValid() const;
41 };
42 
43 struct OH_Data_Value {
44     static constexpr int64_t OH_VALUE_ID = 0x10002000;
45     int64_t id = OH_VALUE_ID;
46 
47     OHOS::NativeRdb::ValueObject value_;
48     bool IsValid() const;
49 };
50 
51 struct OH_Data_Values {
52     static constexpr int64_t OH_VALUES_ID = 0x10003000;
53     int64_t id = OH_VALUES_ID;
54 
55     std::vector<OH_Data_Value> values_;
56     bool IsValid() const;
57 };
58 
59 struct OH_Data_VBuckets {
60     static constexpr int64_t OH_VBUCKETS_ID = 0x10004000;
61     int64_t id = OH_VBUCKETS_ID;
62 
63     std::vector<OH_VBucket *> rows_;
64     bool IsValid() const;
65 };
66 
67 struct OH_Rdb_CryptoParam {
68     static constexpr int64_t OH_CRYPTO_PARAM_ID = 0x10005000;
69     int64_t id = OH_CRYPTO_PARAM_ID;
70 
71     OHOS::NativeRdb::RdbStoreConfig::CryptoParam cryptoParam;
72     bool IsValid() const;
73 };
74 #endif
75