Leosac
0.8.0
Open Source Access Control
|
This is a templated class that perform case-insensitive database search against entities. More...
#include <SearchBase.hpp>
Classes | |
struct | DatabaseEntityComparator |
Public Types | |
using | Query = odb::query< DatabaseEntity > |
using | EntitySet = std::set< DatabaseEntity, DatabaseEntityComparator > |
Public Member Functions | |
std::vector< DatabaseEntity > | search (DBPtr db, const std::string &partial_name_or_alias) |
json | search_json (DBPtr db, const std::string &partial) |
Returns a JSON array with the result from the search. More... | |
Private Member Functions | |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_alias_tag >::value, Query > | build_query (const std::string &partial) |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_name_tag >::value, Query > | build_query (const std::string &partial) |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_username_tag >::value, Query > | build_query (const std::string &partial) |
void | search_and_append (DBPtr db, EntitySet &entities, const std::string &partial) |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_alias_tag >::value, json > | build_json_entry (const DatabaseEntity entity) |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_name_tag >::value, json > | build_json_entry (const DatabaseEntity entity) |
template<typename T > | |
std::enable_if_t< std::is_same< T, use_username_tag >::value, json > | build_json_entry (const DatabaseEntity entity) |
This is a templated class that perform case-insensitive database search against entities.
It can be used to implemented the various search.*
API endpoints.
Definition at line 61 of file SearchBase.hpp.
using Leosac::Module::WebSockAPI::EntitySearchTool< DatabaseEntity, AliasOrName >::EntitySet = std::set<DatabaseEntity, DatabaseEntityComparator> |
Definition at line 78 of file SearchBase.hpp.
using Leosac::Module::WebSockAPI::EntitySearchTool< DatabaseEntity, AliasOrName >::Query = odb::query<DatabaseEntity> |
Definition at line 64 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 140 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 148 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 156 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 83 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 91 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 99 of file SearchBase.hpp.
|
inline |
Definition at line 116 of file SearchBase.hpp.
|
inlineprivate |
Definition at line 105 of file SearchBase.hpp.
|
inline |
Returns a JSON array with the result from the search.
The JSON looks like this: [ {id: ${ENTITY_ID}}, {name|alias|username: ${ENTITY_NAME_OR_ALIAS}} ]
Definition at line 171 of file SearchBase.hpp.