~singpolyma/biboumi

ref: d7427fc9ca4c06fda458e4951559f57163d90b94 biboumi/src/database/column.hpp -rw-r--r-- 546 bytes
d7427fc9 — louiz’ Re-connect to postgresql when the connection is lost 5 years ago
                                                                                
50cadf3d louiz’
a77c982f louiz’
50cadf3d louiz’
369ccb03 louiz’
50cadf3d louiz’
369ccb03 louiz’
50cadf3d louiz’
577984fa louiz’
0168b96b louiz’
fd9c7139 louiz’
0168b96b louiz’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include <cstddef>

template <typename T>
struct Column
{
    Column(T default_value):
        value{default_value} {}
    Column():
        value{} {}
    using real_type = T;
    T value{};
};

struct ForeignKey: Column<std::size_t> {
    static constexpr auto name = "fk_";
};

struct Id: Column<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) {}
};