userver: storages::redis::MemberScore Struct Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
storages::redis::MemberScore Struct Referencefinal

#include <userver/storages/redis/reply_types.hpp>

Detailed Description

Data type that holds member and score.

Sample usage:

constexpr std::size_t kKeysWithSamePrefix = 100;
static const std::string kKey = "key";
for (std::size_t i = 0; i < kKeysWithSamePrefix; ++i) {
redis_client->Zadd(kKey, static_cast<double>(i), "the_value_" + std::to_string(i), {}).Get();
redis_client->Zadd(kKey, static_cast<double>(i), "a_value_" + std::to_string(i), {}).Get();
}
std::size_t matches_found = 0;
for (const storages::redis::MemberScore& ms : redis_client->Zscan(kKey, storages::redis::Match{"the_value*"}, {})) {
const auto& [member, score] = ms;
EXPECT_EQ(member.find("the_value"), 0) << "Does not start with 'the_value'";
++matches_found;
}
EXPECT_EQ(matches_found, kKeysWithSamePrefix);

Definition at line 53 of file reply_types.hpp.

Public Member Functions

 MemberScore (std::string member, double score)
 
 operator std::pair< std::string, double > () const &
 
 operator std::pair< std::string, double > () &&
 
 operator std::pair< const std::string, double > () const &
 
 operator std::pair< const std::string, double > () &&
 
bool operator== (const MemberScore &rhs) const
 
bool operator!= (const MemberScore &rhs) const
 

Public Attributes

std::string member
 
double score {0.0}
 

Constructor & Destructor Documentation

◆ MemberScore()

storages::redis::MemberScore::MemberScore ( std::string member,
double score )
inline

Definition at line 58 of file reply_types.hpp.

Member Function Documentation

◆ operator std::pair< const std::string, double >() [1/2]

storages::redis::MemberScore::operator std::pair< const std::string, double > ( ) &&
inline

Definition at line 66 of file reply_types.hpp.

◆ operator std::pair< const std::string, double >() [2/2]

storages::redis::MemberScore::operator std::pair< const std::string, double > ( ) const &
inline

Definition at line 64 of file reply_types.hpp.

◆ operator std::pair< std::string, double >() [1/2]

storages::redis::MemberScore::operator std::pair< std::string, double > ( ) &&
inline

Definition at line 62 of file reply_types.hpp.

◆ operator std::pair< std::string, double >() [2/2]

storages::redis::MemberScore::operator std::pair< std::string, double > ( ) const &
inline

Definition at line 60 of file reply_types.hpp.

◆ operator!=()

bool storages::redis::MemberScore::operator!= ( const MemberScore & rhs) const
inline

Definition at line 70 of file reply_types.hpp.

◆ operator==()

bool storages::redis::MemberScore::operator== ( const MemberScore & rhs) const
inline

Definition at line 68 of file reply_types.hpp.

Member Data Documentation

◆ member

std::string storages::redis::MemberScore::member

Definition at line 54 of file reply_types.hpp.

◆ score

double storages::redis::MemberScore::score {0.0}

Definition at line 55 of file reply_types.hpp.


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