1 /* 2 * Copyright (c) 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 #ifndef GRD_TYPE_EXPORT_H 17 #define GRD_TYPE_EXPORT_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif // __cplusplus 22 23 #ifndef _WIN32 24 #define GRD_API __attribute__((visibility("default"))) 25 #endif 26 27 typedef struct GRD_DB GRD_DB; 28 29 /** 30 * @brief Open database config 31 */ 32 #define GRD_DB_OPEN_ONLY 0x00 33 #define GRD_DB_OPEN_CREATE 0x01 34 // check data in database if close abnormally last time, if data is corrupted, rebuild the database 35 #define GRD_DB_OPEN_CHECK_FOR_ABNORMAL 0x02 36 // check data in database when open database, if data is corrupted, rebuild the database. 37 #define GRD_DB_OPEN_CHECK 0x04 38 39 /** 40 * @brief Close database config 41 */ 42 #define GRD_DB_CLOSE 0x00 43 #define GRD_DB_CLOSE_IGNORE_ERROR 0x01 44 45 /** 46 * @brief flush database config 47 */ 48 #define GRD_DB_FLUSH_ASYNC 0x00 49 #define GRD_DB_FLUSH_SYNC 0x01 50 51 #define GRD_DOC_ID_DISPLAY 0x01 52 typedef struct Query { 53 const char *filter; 54 const char *projection; 55 } Query; 56 57 /** 58 * @brief Flags for create and drop collection 59 */ 60 #define CHK_EXIST_COLLECTION 1 61 #define CHK_NON_EXIST_COLLECTION 1 62 63 #define GRD_DOC_APPEND 0 64 #define GRD_DOC_REPLACE 1 65 66 #ifdef __cplusplus 67 } 68 #endif // __cplusplus 69 #endif // GRD_TYPE_EXPORT_H