VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Table.hpp File Reference
#include <sqlpp23/sqlpp23.h>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  VoltMod
 

Macros

#define VOLTMOD_COLUMN(Member, SqlName, DataType, HasDefault)
 Declare one column of a sqlpp23 table spec.
 

Typedefs

using VoltMod::HasDefault = std::true_type
 
using VoltMod::Required = std::false_type
 

Macro Definition Documentation

◆ VOLTMOD_COLUMN

#define VOLTMOD_COLUMN (   Member,
  SqlName,
  DataType,
  HasDefault 
)
Value:
struct Member \
{ \
SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(SqlName, Member); \
using data_type = DataType; \
using has_default = HasDefault; \
}

Declare one column of a sqlpp23 table spec.

Member is the C++ member name, SqlName the unquoted column name, DataType a sqlpp23 data type (wrap it in std::optional when the column is nullable), and HasDefault VoltMod::HasDefault or VoltMod::Required.

Most tables are generated from the schema by sqlpp23-ddl2cpp; reach for this only when hand-writing a spec.

struct Bans_
{
VOLTMOD_COLUMN(id, id, sqlpp::integral, VoltMod::HasDefault);
VOLTMOD_COLUMN(steamId, steam_id, sqlpp::integral, VoltMod::Required);
VOLTMOD_COLUMN(reason, reason, std::optional<sqlpp::text>, VoltMod::HasDefault);
SQLPP_CREATE_NAME_TAG_FOR_SQL_AND_CPP(bans, bans);
template <typename T>
using _table_columns = sqlpp::table_columns<T, id, steamId, reason>;
using _required_insert_columns = sqlpp::detail::type_set<sqlpp::column_t<sqlpp::table_t<Bans_>, steamId>>;
};
using Bans = sqlpp::table_t<Bans_>;
#define VOLTMOD_COLUMN(Member, SqlName, DataType, HasDefault)
Declare one column of a sqlpp23 table spec.
Definition Table.hpp:42
std::true_type HasDefault
Definition Table.hpp:10
std::false_type Required
Definition Table.hpp:13

Definition at line 42 of file Table.hpp.