added meta table macro and removed unused query_macro

This commit is contained in:
2025-12-31 13:54:32 +01:00
parent e768497cfd
commit 7cb64515bd
8 changed files with 40 additions and 73 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ add_executable(OrmTests
query/QueryFixture.cpp
query/QueryFixture.hpp
query/QueryTest.cpp
sql/ColumnGeneratorTest.cpp
query/ColumnGeneratorTest.cpp
sql/ColumnTest.cpp
sql/ConnectionPoolFixture.hpp
sql/ConnectionPoolTest.cpp
-33
View File
@@ -35,39 +35,6 @@ using namespace matador::utils;
using namespace matador::sql;
using namespace matador::test;
// #define FIELD(FIELD_NAME) const matador::query::column& FIELD_NAME = create_column(*this, #FIELD_NAME);
//
// #define META_TABLE(TABLE_NAME, VARIABLE_NAME, ...) \
// namespace matador::query::meta { \
// namespace internal { \
// class TABLE_NAME##_table : public table { \
// public: \
// TABLE_NAME##_table() : table(#TABLE_NAME) {} \
// MAP(FIELD, __VA_ARGS__) \
// }; } \
// static const internal:: TABLE_NAME##_table VARIABLE_NAME; \
// }
//
// META_TABLE( books, BOOK, id, author_id, title, published_in )
class book_table : public table {
public:
book_table()
: table("books", {"id", "title", "author_id"})
, id(*column_by_name(*this, "id"))
, title(*column_by_name(*this, "id"))
, author_id(*column_by_name(*this, "author_id")) {
}
const table_column& id;
const table_column& title;
const table_column& author_id;
};
book_table BOOK;
using namespace matador::test;
TEST_CASE("Create sql query data for entity with eager has one", "[query][entity][builder]") {
using namespace matador::test;
backend_provider::instance().register_backend("noop", std::make_unique<orm::test_backend_service>());
-3
View File
@@ -1,8 +1,6 @@
#include <atomic>
#include <catch2/catch_test_macros.hpp>
#include <matador/query/query.hpp>
#include "matador/sql/connection_pool.hpp"
#include "matador/sql/error_code.hpp"
#include "matador/sql/statement_cache.hpp"
@@ -19,7 +17,6 @@
using namespace matador::test;
using namespace matador::sql;
using namespace matador::query;
using namespace matador::utils;
class MetricsObserver {