37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
#ifndef MATADOR_CONSTRAINT_HPP
|
|
#define MATADOR_CONSTRAINT_HPP
|
|
|
|
#include <string>
|
|
|
|
namespace matador::utils {
|
|
enum class constraints : unsigned char;
|
|
}
|
|
|
|
namespace matador::query {
|
|
class table_constraint {
|
|
public:
|
|
table_constraint() = default;
|
|
table_constraint(std::string column_name, std::string table_name, utils::constraints type);
|
|
table_constraint(std::string column_name, std::string table_name, utils::constraints type, std::string referenced_table, std::string referenced_column);
|
|
table_constraint(std::string name, std::string column_name, std::string table_name, utils::constraints type, std::string referenced_table, std::string referenced_column);
|
|
|
|
[[nodiscard]] std::string name() const;
|
|
[[nodiscard]] std::string column_name() const;
|
|
[[nodiscard]] std::string table_name() const;
|
|
[[nodiscard]] const utils::constraints& type() const;
|
|
[[nodiscard]] bool is_primary_key_constraint() const;
|
|
[[nodiscard]] bool is_foreign_key_constraint() const;
|
|
[[nodiscard]] bool is_unique_constraint() const;
|
|
[[nodiscard]] const std::string& referenced_table() const;
|
|
[[nodiscard]] const std::string& referenced_column() const;
|
|
|
|
private:
|
|
std::string name_;
|
|
std::string column_name_;
|
|
std::string table_name_;
|
|
utils::constraints type_{};
|
|
std::string referenced_table_;
|
|
std::string referenced_column_;
|
|
};
|
|
}
|
|
#endif //MATADOR_CONSTRAINT_HPP
|