Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
Model.hpp File Reference
Include dependency graph for Model.hpp:

Go to the source code of this file.

Macros

#define ORBIT_REGISTER_MODEL(Type, TableName)
 Registers a standard C++ struct as an ORM Model mapping to a database table.
 
#define ORBIT_REGISTER_MONGO_MODEL(Type)
 Registers a standard C++ struct as an ORM Model mapping to a MongoDB Collection.
 

Macro Definition Documentation

◆ ORBIT_REGISTER_MODEL

#define ORBIT_REGISTER_MODEL (   Type,
  TableName 
)
Value:
template <typename DBClient> \
inline orm::QueryBuilder<DBClient, Type> query_##Type(std::shared_ptr<DBClient> db) { \
return orm::QueryBuilder<DBClient, Type>(db, TableName); \
}
A lightweight, JSON-backed ORM Query Builder.
Definition QueryBuilder.hpp:112

Registers a standard C++ struct as an ORM Model mapping to a database table.

Must be used in the global namespace after defining the struct and its NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE macro.

Parameters
TypeThe C++ struct/class name.
TableNameThe database table name as a string.

◆ ORBIT_REGISTER_MONGO_MODEL

#define ORBIT_REGISTER_MONGO_MODEL (   Type)
Value:
inline orm::MongoQueryBuilder<Type> query_mongo_##Type(std::shared_ptr<database::MongoClient> db) { \
}
A lightweight ORM builder for MongoDB using nlohmann::json.
Definition MongoQueryBuilder.hpp:54

Registers a standard C++ struct as an ORM Model mapping to a MongoDB Collection.

Parameters
TypeThe C++ struct/class name.