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;
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
[[nodiscard]] utils::result<bool, utils::error> table_exists(const std::string &table_name) const;
|
||||
|
||||
private:
|
||||
sql::query_context build_add_constraint_context( const object::repository_node& node, const class object::constraint& cons ) const;
|
||||
sql::query_context build_drop_constraint_context( const object::repository_node& node, const class object::constraint& cons ) const;
|
||||
sql::query_context build_add_constraint_context( const object::repository_node& node, const class object::restriction& cons ) const;
|
||||
sql::query_context build_drop_constraint_context( const object::repository_node& node, const class object::restriction& cons ) const;
|
||||
|
||||
private:
|
||||
object::repository repo_;
|
||||
|
||||
@@ -145,7 +145,7 @@ private:
|
||||
friend class query_select;
|
||||
|
||||
static query::fetchable_query build_select_query(entity_query_data &&data);
|
||||
static sql::query_context build_add_constraint_context(const std::string& table_name, const class object::constraint& cons, const sql::connection_ptr &conn) ;
|
||||
static sql::query_context build_add_constraint_context(const std::string& table_name, const class object::restriction& cons, const sql::connection_ptr &conn) ;
|
||||
|
||||
private:
|
||||
mutable sql::statement_cache cache_;
|
||||
|
||||
@@ -64,9 +64,9 @@ using Boolean = typed_data_type<bool>;
|
||||
using Varchar = sized_typed_data_type<std::string>;
|
||||
using Blob = sized_typed_data_type<std::vector<std::byte>>;
|
||||
|
||||
class constraint {
|
||||
class restriction {
|
||||
public:
|
||||
explicit constraint(std::string name)
|
||||
explicit restriction(std::string name)
|
||||
: name_(std::move(name)) {}
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
constraint_builder& references(std::string table, std::string column);
|
||||
|
||||
// ReSharper disable once CppNonExplicitConversionOperator
|
||||
operator object::constraint() const; // NOLINT(*-explicit-constructor)
|
||||
operator object::restriction() const; // NOLINT(*-explicit-constructor)
|
||||
|
||||
private:
|
||||
std::string constraint_name;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define MATADOR_QUERY_ALTER_TABLE_INTERMEDIATE_HPP
|
||||
|
||||
#include "executable_query.hpp"
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
#include "matador/query/intermediates/query_intermediate.hpp"
|
||||
|
||||
namespace matador::query {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "matador/query/intermediates/executable_query.hpp"
|
||||
|
||||
#include "matador/object/attribute.hpp"
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -16,8 +16,8 @@ class query_create_table_columns_intermediate : public executable_query {
|
||||
public:
|
||||
using executable_query::executable_query;
|
||||
|
||||
executable_query constraints(std::initializer_list<class object::constraint> constraints);
|
||||
executable_query constraints(const std::list<class object::constraint> &constraints);
|
||||
executable_query constraints(std::initializer_list<class object::restriction> constraints);
|
||||
executable_query constraints(const std::list<class object::restriction> &constraints);
|
||||
};
|
||||
|
||||
class query_create_table_intermediate : public query_intermediate {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "matador/query/table.hpp"
|
||||
|
||||
#include "matador/object/attribute.hpp"
|
||||
#include "matador/object/constraint.hpp"
|
||||
#include "matador/object/restriction.hpp"
|
||||
|
||||
#include "matador/utils/placeholder.hpp"
|
||||
|
||||
@@ -392,15 +392,15 @@ private:
|
||||
|
||||
class query_create_table_constraints_part final : public query_part {
|
||||
public:
|
||||
explicit query_create_table_constraints_part(const std::list<class object::constraint> &constraints);
|
||||
explicit query_create_table_constraints_part(const std::list<class object::restriction> &constraints);
|
||||
|
||||
[[nodiscard]] const std::list<class object::constraint>& constraints() const;
|
||||
[[nodiscard]] const std::list<class object::restriction>& constraints() const;
|
||||
|
||||
private:
|
||||
void accept(query_part_visitor &visitor) override;
|
||||
|
||||
private:
|
||||
std::list<class object::constraint> constraints_;
|
||||
std::list<class object::restriction> constraints_;
|
||||
};
|
||||
|
||||
class query_create_schema_part final : public query_part {
|
||||
|
||||
Reference in New Issue
Block a user