drogon
C++14/17-based HTTP application framework
Loading...
Searching...
No Matches
drogon::RestfulController Class Reference

this class is a helper class for the implementation of restful api controllers generated by the drogon_ctl command. More...

#include <drogon/orm/RestfulController.h>

Inheritance diagram for drogon::RestfulController:
Collaboration diagram for drogon::RestfulController:

Public Member Functions

void enableMasquerading (const std::vector< std::string > &pMasqueradingVector)
void disableMasquerading ()
void registerAJsonValidator (const std::string &fieldName, const std::function< bool(const Json::Value &, std::string &)> &validator)
void registerAJsonValidator (const std::string &fieldName, std::function< bool(const Json::Value &, std::string &)> &&validator)
orm::Criteria makeCriteria (const Json::Value &pJson) noexcept(false)
 make a criteria object for searching by ORM.

Protected Member Functions

 RestfulController (const std::vector< std::string > &columnsVector)
std::vector< std::string > fieldsSelector (const std::set< std::string > &fields)
template<typename T>
Json::Value makeJson (const HttpRequestPtr &req, const T &obj)
bool doCustomValidations (const Json::Value &pJson, std::string &err)
bool isMasquerading () const
const std::vector< std::string > & masqueradingVector () const

Detailed Description

this class is a helper class for the implementation of restful api controllers generated by the drogon_ctl command.

Member Function Documentation

◆ makeCriteria()

orm::Criteria drogon::RestfulController::makeCriteria ( const Json::Value & pJson)

make a criteria object for searching by ORM.

Parameters
pJsonthe json object presenting search criteria. The json object must be an array of depth 3. for example: [ [ ["color","=","red"], //AND ["price","<",1000] ], //OR [ ["color","=","white"], //AND ["price","<",800], //AND ["brand","!=",null] ] ]
Returns
orm::Criteria

The documentation for this class was generated from the following file: