summaryrefslogtreecommitdiff
path: root/src/database/column.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/column.hpp')
-rw-r--r--src/database/column.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/database/column.hpp b/src/database/column.hpp
index 50c9c14..837aa3f 100644
--- a/src/database/column.hpp
+++ b/src/database/column.hpp
@@ -9,18 +9,30 @@ struct Column
value{default_value} {}
Column():
value{} {}
+ void clear()
+ {
+ this->value = {};
+ }
using real_type = T;
T value{};
};
+template <typename T>
+struct UnclearableColumn: public Column<T>
+{
+ using Column<T>::Column;
+ void clear()
+ { }
+};
+
struct ForeignKey: Column<std::size_t> {
static constexpr auto name = "fk_";
};
-struct Id: Column<std::size_t> {
+struct Id: UnclearableColumn<std::size_t> {
static constexpr std::size_t unset_value = static_cast<std::size_t>(-1);
static constexpr auto name = "id_";
static constexpr auto options = "PRIMARY KEY";
- Id(): Column<std::size_t>(unset_value) {}
+ Id(): UnclearableColumn<std::size_t>(unset_value) {}
};