#include #include #include #include namespace test_to_create_table { struct TestTable { std::string field1; int32_t field2; sqlgen::PrimaryKey id; std::optional nullable; }; TEST(general, test_to_create_table) { const auto create_table_stmt = sqlgen::transpilation::to_create_table(); const std::string expected = R"({"table":{"name":"TestTable"},"columns":[{"name":"field1","type":{"type":"Text","properties":{"primary":false,"nullable":false}}},{"name":"field2","type":{"type":"Int32","properties":{"primary":false,"nullable":false}}},{"name":"id","type":{"type":"UInt32","properties":{"primary":true,"nullable":false}}},{"name":"nullable","type":{"type":"Text","properties":{"primary":false,"nullable":true}}}],"if_not_exists":true})"; const auto json_str = rfl::json::write(create_table_stmt); EXPECT_EQ(json_str, expected); } } // namespace test_to_create_table