
"Rene Rivera" <grafikrobot@gmail.com> wrote
Here's part of a short example of what we are considering:
template <typename C> struct Person : rsi::db::schema::table_def< C, Person<C> > { column id; column first_name; column last_name; column address; column mail_address; column phone;
template <typename T> typename T::result_type operator()(T const & transform) { return transform( table("Person") <<= id("id") % integer[autoincrement] & not_null & primary_key
<<= first_name("first_name") % character(50)[varying] & not_null
<<= last_name("last_name") % character(50)[varying] & not_null
<<= address("address_id") >> Address<C>().id
<<= mail_address("mail_address_id") >> Address<C>().id
<<= phone("phone") % character(20)[varying] & not_null ); } };
Do I understand correctly that this code maps a database record into a C++ structure? Is it possible to enforce correct types here, instead of using universal "column" type? Regards, Arkadiy