使用boost pfr 遍历结构体
This commit is contained in:
@@ -92,11 +92,13 @@ Psc::JSON External_Database_Row::to_json() const {
|
||||
|
||||
External_Resources::External_Resources(
|
||||
std::string name, std::string cache_file_name, std::string download_url,
|
||||
std::string description, const std::uint64_t update_interval_seconds)
|
||||
: name(std::move(name)), cache_file_name(std::move(cache_file_name)),
|
||||
download_url(std::move(download_url)),
|
||||
description(std::move(description)),
|
||||
update_interval_seconds(update_interval_seconds) {}
|
||||
std::string description, const std::uint64_t update_interval_seconds) {
|
||||
this->name = std::move(name);
|
||||
this->cache_file_name = std::move(cache_file_name);
|
||||
this->download_url = std::move(download_url);
|
||||
this->description = std::move(description);
|
||||
this->update_interval_seconds = update_interval_seconds;
|
||||
}
|
||||
|
||||
void External_Resources::mark_updated() {
|
||||
last_updated_at = std::time(nullptr);
|
||||
@@ -267,7 +269,7 @@ void External_Resources_Manager::init(const Psc::JSON *that_json) {
|
||||
Get_J(ecap_sqlite_path)
|
||||
}
|
||||
|
||||
Psc::JSON External_Resources_Manager::to_json() const {
|
||||
Psc::JSON External_Resources_Manager::to_base_json() const {
|
||||
std::lock_guard lock(mtx_);
|
||||
auto ret = Psc::JSON::object();
|
||||
Ret_J(ecap_sqlite_path) auto list = Psc::JSON::array();
|
||||
@@ -530,7 +532,7 @@ void External_Resources_Manager::server(Global *g) {
|
||||
const auto &api = g->api;
|
||||
|
||||
svr.Post(api + "get_external_database_config", [this](HTTP_Param) {
|
||||
auto t = warp(to_json()).to_json_string();
|
||||
auto t = warp(to_base_json()).to_json_string();
|
||||
|
||||
res->setBody(t);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user