mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-04 00:20:16 -06:00
schema and table name as constexpr const char
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user