mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-05 17:09:50 -06:00
Added support for schemata
This commit is contained in:
22
tests/test_schema.cpp
Normal file
22
tests/test_schema.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <sqlgen.hpp>
|
||||
#include <sqlgen/parsing/to_create_table.hpp>
|
||||
|
||||
namespace test_schema {
|
||||
|
||||
struct TestTable {
|
||||
using schema = sqlgen::Literal<"test">;
|
||||
|
||||
std::string field1;
|
||||
int32_t field2;
|
||||
sqlgen::PrimaryKey<uint32_t> id;
|
||||
std::optional<std::string> nullable;
|
||||
};
|
||||
|
||||
TEST(general, test_schema) {
|
||||
const auto create_table_stmt = sqlgen::parsing::to_create_table<TestTable>();
|
||||
|
||||
EXPECT_EQ(create_table_stmt.table.schema, "test");
|
||||
}
|
||||
} // namespace test_schema
|
||||
Reference in New Issue
Block a user