#include #include #include #include #include #include namespace test_is_null_dry { struct Person { sqlgen::PrimaryKey id; std::string first_name; std::string last_name; std::optional age; }; TEST(mysql, test_is_null_dry) { using namespace sqlgen; using namespace sqlgen::literals; const auto sql = mysql::to_sql(sqlgen::read> | where("age"_c.is_null()) | order_by("first_name"_c.desc())); const std::string expected = R"(SELECT `id`, `first_name`, `last_name`, `age` FROM `Person` WHERE `age` IS NULL ORDER BY `first_name` DESC)"; EXPECT_EQ(sql, expected); } } // namespace test_is_null_dry