query builder progress

This commit is contained in:
Sascha Kühl
2025-12-02 16:19:13 +01:00
parent c156ab5e74
commit bfbbd4c589
31 changed files with 348 additions and 164 deletions
+12 -12
View File
@@ -22,15 +22,15 @@ TEST_CASE("Generate column definitions from object", "[column][definition][gener
auto columns = attribute_generator::generate<matador::test::product>(repo, obj);
const std::vector expected_columns = {
attribute{"product_name", basic_type::type_varchar, constraints::PrimaryKey, null_option_type::NOT_NULL },
attribute{"supplier_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NOT_NULL },
attribute{"category_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NOT_NULL },
attribute{"quantity_per_unit", basic_type::type_varchar, null_attributes, null_option_type::NOT_NULL },
attribute{"unit_price", basic_type::type_uint32, null_attributes, null_option_type::NOT_NULL },
attribute{"units_in_stock", basic_type::type_uint32, null_attributes, null_option_type::NOT_NULL },
attribute{"units_in_order", basic_type::type_uint32, null_attributes, null_option_type::NOT_NULL },
attribute{"reorder_level", basic_type::type_uint32, null_attributes, null_option_type::NOT_NULL },
attribute{"discontinued", basic_type::type_bool, null_attributes, null_option_type::NOT_NULL }
attribute{"product_name", basic_type::type_varchar, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"supplier_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"category_id", basic_type::type_uint32, constraints::ForeignKey, null_option_type::NotNull },
attribute{"quantity_per_unit", basic_type::type_varchar, null_attributes, null_option_type::NotNull },
attribute{"unit_price", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"units_in_stock", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"units_in_order", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"reorder_level", basic_type::type_uint32, null_attributes, null_option_type::NotNull },
attribute{"discontinued", basic_type::type_bool, null_attributes, null_option_type::NotNull }
};
REQUIRE(!columns.empty());
REQUIRE(columns.size() == expected_columns.size());
@@ -49,9 +49,9 @@ TEST_CASE("Generate columns from object with nullable columns", "[column generat
auto columns = attribute_generator::generate<matador::test::optional>(repo, obj);
const std::vector expected_columns = {
attribute{"id", basic_type::type_uint32, constraints::PrimaryKey, null_option_type::NOT_NULL },
attribute{"name", basic_type::type_varchar, null_attributes, null_option_type::NOT_NULL },
attribute{"age", basic_type::type_uint32, null_attributes, null_option_type::NOT_NULL }
attribute{"id", basic_type::type_uint32, constraints::PrimaryKey, null_option_type::NotNull },
attribute{"name", basic_type::type_varchar, null_attributes, null_option_type::NotNull },
attribute{"age", basic_type::type_uint32, null_attributes, null_option_type::NotNull }
};
REQUIRE(!columns.empty());
REQUIRE(columns.size() == expected_columns.size());