Created
January 25, 2015 18:30
-
-
Save niXman/fb6013e9b96ee1cfb91e to your computer and use it in GitHub Desktop.
PP output ;)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace table { | |
namespace table_ { | |
struct id { | |
struct _name_t { | |
static constexpr const char* _get_name() { return "id"; } | |
template <typename T> | |
struct _member_t { | |
T id; | |
T& operator()() { return id; } | |
const T& operator()() const { return id; } | |
}; | |
using _traits = sqlpp::make_traits<[(NOT_NULL, PRIMARY_KEY, AUTO_INCREMENT)]>; | |
}; | |
}; | |
struct name { | |
struct _name_t { | |
static constexpr const char* _get_name() { return "name"; } | |
template <typename T> | |
struct _member_t { | |
T name; | |
T& operator()() { return name; } | |
const T& operator()() const { return name; } | |
}; | |
using _traits = sqlpp::make_traits<[(NOT_NULL, INDEX("name_index"), DEFAULT("any name"))]>; | |
}; | |
}; | |
struct age { | |
struct _name_t { | |
static constexpr const char* _get_name() { return "age"; } | |
template <typename T> | |
struct _member_t { | |
T age; | |
T& operator()() { return age; } | |
const T& operator()() const { return age; } | |
}; | |
using _traits = sqlpp::make_traits<[(NOT_NULL, INDEX("age_index"), UNIQUE, COMMENT("some comments"))]>; | |
}; | |
}; | |
} // ns table_ | |
struct table: sqlpp::table_t<table, table_::id, table_::name, table_::age> { | |
struct _name_t { | |
static constexpr const char* _get_name() { return "table"; } | |
template <typename T> | |
struct _member_t { | |
T table; | |
T& operator()() { return table; } | |
const T& operator()() const { return table; } | |
}; | |
}; | |
}; | |
} // ns table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quite impressive!
It is the release-style though, not the develop style. Please take a look here:
https://github.com/rbock/sqlpp11/blob/develop/tests/Sample.h
The changes should be fairly simple though.