schema and table name as constexpr const char

This commit is contained in:
Dr. Patrick Urbanke
2025-04-05 06:45:46 +02:00
parent 081a0414c7
commit 6074ea4313
4 changed files with 6 additions and 4 deletions

View File

@@ -2,12 +2,13 @@
#define SQLGEN_PARSING_HAS_SCHEMA_HPP_
#include <concepts>
#include <string>
namespace sqlgen::parsing {
template <typename T>
concept has_schema = requires() {
{ typename T::schema() } -> std::same_as<typename T::schema>;
{ T::schema } -> std::convertible_to<std::string>;
};
} // namespace sqlgen::parsing

View File

@@ -2,12 +2,13 @@
#define SQLGEN_PARSING_HAS_TABLENAME_HPP_
#include <concepts>
#include <string>
namespace sqlgen::parsing {
template <typename T>
concept has_tablename = requires() {
{ typename T::tablename() } -> std::same_as<typename T::tablename>;
{ T::tablename } -> std::convertible_to<std::string>;
};
} // namespace sqlgen::parsing

View File

@@ -6,7 +6,7 @@
namespace test_schema {
struct TestTable {
using schema = sqlgen::Literal<"test">;
static constexpr const char* schema = "test";
std::string field1;
int32_t field2;

View File

@@ -6,7 +6,7 @@
namespace test_tablename {
struct TestTable {
using tablename = sqlgen::Literal<"TEST_TABLE">;
static constexpr const char* tablename = "TEST_TABLE";
std::string field1;
int32_t field2;