Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:19

0001 /* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com)
0002  *
0003  * Distributed under the Boost Software License, Version 1.0. (See
0004  * accompanying file LICENSE.txt)
0005  */
0006 
0007 #ifndef BOOST_REDIS_ADAPTER_IGNORE_HPP
0008 #define BOOST_REDIS_ADAPTER_IGNORE_HPP
0009 
0010 #include <boost/redis/resp3/node.hpp>
0011 #include <boost/redis/error.hpp>
0012 #include <boost/system/error_code.hpp>
0013 #include <string>
0014 
0015 namespace boost::redis::adapter
0016 {
0017 
0018 /** @brief An adapter that ignores responses
0019  *  @ingroup high-level-api
0020  *
0021  *  RESP3 errors won't be ignored.
0022  */
0023 struct ignore {
0024    void operator()(resp3::basic_node<std::string_view> const& nd, system::error_code& ec)
0025    {
0026       switch (nd.data_type) {
0027          case resp3::type::simple_error: ec = redis::error::resp3_simple_error; break;
0028          case resp3::type::blob_error: ec = redis::error::resp3_blob_error; break;
0029          case resp3::type::null: ec = redis::error::resp3_null; break;
0030          default:;
0031       }
0032    }
0033 };
0034 
0035 } // boost::redis::adapter
0036 
0037 #endif // BOOST_REDIS_ADAPTER_IGNORE_HPP