From ab66106384117d98fdea4cdf6e4df04398a6ac89 Mon Sep 17 00:00:00 2001 From: yuzhang Date: Mon, 14 Nov 2022 13:56:51 +0800 Subject: [PATCH] =?UTF-8?q?save=E6=94=AF=E6=8C=81=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/data_layer.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/util/data_layer.hpp b/src/util/data_layer.hpp index fde84bae..9a665090 100644 --- a/src/util/data_layer.hpp +++ b/src/util/data_layer.hpp @@ -648,7 +648,7 @@ public: * \param prx 数据服务代理 * \return */ - template auto save(std::shared_ptr prx) -> void { + template auto save(std::shared_ptr prx, const std::string& filter = "") -> void { if (read_only_) { return; } @@ -657,7 +657,7 @@ public: return; } proxy_id_ = prx->getID(); - auto json_str = save(); + auto json_str = save(filter); if (json_str.empty()) { return; } @@ -983,7 +983,7 @@ public: * * \return 保存数据的JSON串 */ - inline auto save() -> std::string { + inline auto save(const std::string& filter = "") -> std::string { /* * 保存 * @@ -1020,6 +1020,8 @@ public: root["index_value"] = std::move(get_index_value_string()); root["expiration"] = expiration_; root["values"] = Json::Value(Json::ValueType::arrayValue); + if(!filter.empty()) + root["filter"] = filter; for (auto &ptr : field_vec_) { if (ptr->is_dirty()) { Json::Value value; -- Gitee