aboutsummaryrefslogtreecommitdiff
path: root/hello/person.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'hello/person.hxx')
-rw-r--r--hello/person.hxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/hello/person.hxx b/hello/person.hxx
index 69b1878..f480723 100644
--- a/hello/person.hxx
+++ b/hello/person.hxx
@@ -6,6 +6,7 @@
#define PERSON_HXX
#include <string>
+#include <cstddef> // std::size_t
#include <odb/core.hxx>
@@ -57,4 +58,17 @@ private:
unsigned short age_;
};
+#pragma db view object(person)
+struct person_stat
+{
+ #pragma db column("count(" + person::id_ + ")")
+ std::size_t count;
+
+ #pragma db column("min(" + person::age_ + ")")
+ unsigned short min_age;
+
+ #pragma db column("max(" + person::age_ + ")")
+ unsigned short max_age;
+};
+
#endif // PERSON_HXX