* Copyright (C) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_MEDIA_CLOUD_SYNC_DATABASE_H
#define OHOS_MEDIA_CLOUD_SYNC_DATABASE_H
#include <functional>
#include <map>
#include <string>
#include <vector>
#include <mutex>
#include <shared_mutex>
#include <list>
#include "mdk_record.h"
#include "mdk_result.h"
#define EXPORT __attribute__ ((visibility ("default")))
namespace OHOS::Media::CloudSync {
struct MDKSchemaField {
std::string name;
MDKRecordFieldType type;
bool primary;
bool nullable;
bool sortable;
bool searchable;
bool queryable;
MDKRecordFieldType listType;
std::string refRecordType;
};
struct MDKSchemaRelation {
std::string relationName;
std::string recordType;
std::map<std::string, std::string> refFields;
};
struct MDKSchemaNode {
std::string recordType;
std::string tableName;
std::map<std::string, MDKSchemaField> fields;
std::vector<std::string> dupCheckFields;
std::string sharedTableName;
std::vector<MDKSchemaRelation> relations;
};
struct MDKOrderTable {
std::string recordType;
std::string tableName;
};
struct MDKSchema {
int64_t version;
std::map<std::string, MDKSchemaNode> recordTypes;
std::string schemaData;
std::vector<MDKOrderTable> orderTables;
};
}
#endif