6#include <userver/storages/redis/exception.hpp>
7#include <userver/storages/redis/impl/base.hpp>
8#include <userver/storages/redis/impl/command_options.hpp>
10#include <userver/storages/redis/scan_tag.hpp>
12USERVER_NAMESPACE_BEGIN
14namespace storages::
redis {
21using RangeOptions = USERVER_NAMESPACE::redis::RangeOptions;
22using GeoaddArg = USERVER_NAMESPACE::redis::GeoaddArg;
23using GeoradiusOptions = USERVER_NAMESPACE::redis::GeoradiusOptions;
24using GeosearchOptions = USERVER_NAMESPACE::redis::GeosearchOptions;
25using ZaddOptions = USERVER_NAMESPACE::redis::ZaddOptions;
29 ScanOptionsBase() =
default;
35 template <
typename... Args>
36 ScanOptionsBase(Args&&... args) {
37 (Apply(std::forward<Args>(args)), ...);
42 explicit Match(std::string value) : value_(std::move(value)) {}
44 const std::string& Get()
const& {
return value_; }
46 std::string Get() && {
return std::move(value_); }
54 explicit Count(size_t value) : value_(value) {}
56 size_t Get()
const {
return value_; }
62 std::optional<
Match> ExtractMatch() {
return std::move(pattern_); }
64 std::optional<
Count> ExtractCount() {
return std::move(count_); }
67 void Apply(
Match pattern) {
69 pattern_ = std::move(pattern);
72 void Apply(
Count count) {
77 std::optional<
Match> pattern_;
78 std::optional<
Count> count_;
82template <ScanTag scan_tag>
92void PutArg(USERVER_NAMESPACE::redis::CmdArgs::CmdArgsArray& args_, std::optional<
ScanOptionsBase::
Match> arg);
93void PutArg(USERVER_NAMESPACE::redis::CmdArgs::CmdArgsArray& args_, std::optional<
ScanOptionsBase::
Count> arg);