renamed constraint to restriction
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#define BASIC_PROTOTYPE_INFO_HPP
|
||||
|
||||
#include "matador/object/attribute.hpp"
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
#include "matador/object/relation_endpoint.hpp"
|
||||
|
||||
#include "matador/utils/identifier.hpp"
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
[[nodiscard]] std::string name() const;
|
||||
[[nodiscard]] std::shared_ptr<class object> object() const;
|
||||
[[nodiscard]] const std::list<attribute>& attributes() const;
|
||||
[[nodiscard]] const std::list<class constraint>& constraints() const;
|
||||
[[nodiscard]] const std::list<class restriction>& constraints() const;
|
||||
|
||||
[[nodiscard]] bool has_primary_key() const;
|
||||
[[nodiscard]] const utils::identifier& primary_key() const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef MATADOR_CONSTRAINTS_GENERATOR_HPP
|
||||
#define MATADOR_CONSTRAINTS_GENERATOR_HPP
|
||||
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
|
||||
#include "matador/utils/access.hpp"
|
||||
#include "matador/utils/field_attributes.hpp"
|
||||
@@ -17,20 +17,20 @@ class repository;
|
||||
|
||||
class constraints_generator final {
|
||||
private:
|
||||
constraints_generator(std::list<class constraint> &constraints, const repository &repo, const std::shared_ptr<object> &obj);
|
||||
constraints_generator(std::list<class restriction> &constraints, const repository &repo, const std::shared_ptr<object> &obj);
|
||||
|
||||
public:
|
||||
constraints_generator() = delete;
|
||||
|
||||
template < typename Type >
|
||||
static std::list<class constraint> generate(const repository &repo, object &obj) {
|
||||
static std::list<class restriction> generate(const repository &repo, const std::shared_ptr<object> &obj) {
|
||||
Type t;
|
||||
return generate(t, repo, obj);
|
||||
}
|
||||
|
||||
template < typename Type >
|
||||
static std::list<class constraint> generate(const Type& t, const repository &repo, object &obj) {
|
||||
std::list<class constraint> constraints;
|
||||
static std::list<class restriction> generate(const Type& t, const repository &repo, const std::shared_ptr<object> &obj) {
|
||||
std::list<class restriction> constraints;
|
||||
constraints_generator gen(constraints, repo, obj);
|
||||
access::process(gen, t);
|
||||
return constraints;
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
[[nodiscard]] std::list<attribute>::iterator find_attribute_by_name(const std::string &name) const;
|
||||
|
||||
private:
|
||||
std::list<class constraint> &constraints_;
|
||||
std::list<class restriction> &constraints_;
|
||||
const repository &repo_;
|
||||
std::shared_ptr<object> obj_;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define MATADOR_OBJECT_HPP
|
||||
|
||||
#include "matador/object/attribute.hpp"
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
|
||||
#include "matador/utils/identifier.hpp"
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
[[nodiscard]] bool has_constraints() const;
|
||||
[[nodiscard]] size_t constraint_count() const;
|
||||
[[nodiscard]] const std::list<class constraint>& constraints() const;
|
||||
[[nodiscard]] const std::list<class restriction>& constraints() const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const object& obj);
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
attribute* pk_attribute_{nullptr};
|
||||
utils::identifier pk_identifier_;
|
||||
std::list<attribute> attributes_;
|
||||
std::list<class constraint> constraints_;
|
||||
std::list<class restriction> constraints_;
|
||||
};
|
||||
}
|
||||
#endif //MATADOR_OBJECT_HPP
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
|
||||
public:
|
||||
template < class Type >
|
||||
static std::shared_ptr<object> generate(const repository &repo, const std::string &name, const std::string &alias = "") {
|
||||
static std::shared_ptr<object> generate(repository &repo, const std::string &name, const std::string &alias = "") {
|
||||
return generate(std::make_unique<Type>(), repo, name, alias);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ class constraint_builder;
|
||||
class constraint_generator;
|
||||
class object;
|
||||
|
||||
class constraint {
|
||||
class restriction {
|
||||
public:
|
||||
constraint() = default;
|
||||
explicit constraint(std::string name);
|
||||
restriction() = default;
|
||||
explicit restriction(std::string name);
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
[[nodiscard]] const class attribute* attribute() const;
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
[[nodiscard]] const std::string& ref_table_name() const;
|
||||
[[nodiscard]] const std::string& ref_column_name() const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const constraint& c);
|
||||
friend std::ostream& operator<<(std::ostream& os, const restriction& c);
|
||||
|
||||
private:
|
||||
friend class constraint_builder;
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
constraint_builder& foreign_key(std::string name);
|
||||
constraint_builder& references(std::string table, std::string column);
|
||||
|
||||
operator class constraint() const;
|
||||
operator class restriction() const;
|
||||
|
||||
private:
|
||||
std::string constraint_name;
|
||||
Reference in New Issue
Block a user