46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#ifndef MATADOR_RESTRICTION_HPP
|
|
#define MATADOR_RESTRICTION_HPP
|
|
|
|
#include "matador/utils/constraints.hpp"
|
|
|
|
#include <memory>
|
|
#include <ostream>
|
|
#include <string>
|
|
#include <variant>
|
|
|
|
namespace matador::object {
|
|
|
|
class attribute;
|
|
class constraint_builder;
|
|
class constraint_generator;
|
|
class object;
|
|
|
|
class restriction {
|
|
public:
|
|
explicit restriction(const class attribute& attr);
|
|
|
|
[[nodiscard]] const class attribute& attribute() const;
|
|
[[nodiscard]] std::string column_name() const;
|
|
[[nodiscard]] std::shared_ptr<object> owner() const;
|
|
[[nodiscard]] bool is_primary_key_constraint() const;
|
|
[[nodiscard]] bool is_foreign_key_constraint() const;
|
|
[[nodiscard]] bool is_unique_constraint() const;
|
|
[[nodiscard]] std::string ref_table_name() const;
|
|
[[nodiscard]] std::string ref_column_name() const;
|
|
|
|
friend std::ostream& operator<<(std::ostream& os, const restriction& c);
|
|
|
|
[[nodiscard]] std::string type_string() const;
|
|
|
|
private:
|
|
friend class constraint_builder;
|
|
friend class object_generator;
|
|
friend class object;
|
|
|
|
const class attribute& attr_;
|
|
std::weak_ptr<object> owner_;
|
|
std::weak_ptr<object> reference_;
|
|
utils::constraints options_{utils::constraints::None};
|
|
};
|
|
}
|
|
#endif //MATADOR_RESTRICTION_HPP
|