Skip to content

Commit 626e6d3

Browse files
Remove deprecated api GEORADIUSBYMEMBER (#1162)
* Refactored geoRadiusByMemberStore by removing GEORADIUSBYMEMBER * Create new inputType * Create test to new inputType * Remove GEORADIUSBYMEMBER and refactor geoRadiusByMember * create new Tuple * run fmt * fix test * remove GEORADIUS * fix fmt --------- Co-authored-by: Dejan Mijić <dmijic@acm.org>
1 parent fe12036 commit 626e6d3

File tree

4 files changed

+203
-114
lines changed

4 files changed

+203
-114
lines changed

modules/redis/src/main/scala/zio/redis/Input.scala

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ object Input {
7575
RespCommand(RespCommandArgument.Value(data))
7676
}
7777

78+
final case class FromMemberInput[A: BinaryCodec]() extends Input[A] {
79+
def encode(data: A): RespCommand =
80+
RespCommand(RespCommandArgument.Literal("FROMMEMBER"), RespCommandArgument.Value(data))
81+
}
82+
7883
case object AuthInput extends Input[Auth] {
7984
def encode(data: Auth): RespCommand =
8085
data.username match {
@@ -174,6 +179,11 @@ object Input {
174179
RespCommand(RespCommandArgument.Value(data.toString))
175180
}
176181

182+
case object ByRadiusInput extends Input[Double] {
183+
def encode(data: Double): RespCommand =
184+
RespCommand(RespCommandArgument.Literal("BYRADIUS"), RespCommandArgument.Value(data.toString))
185+
}
186+
177187
case object DurationMillisecondsInput extends Input[Duration] {
178188
def encode(data: Duration): RespCommand =
179189
RespCommand(RespCommandArgument.Value(data.toMillis.toString))
@@ -351,6 +361,15 @@ object Input {
351361
)
352362
}
353363

364+
case object FromLonLatInput extends Input[LongLat] {
365+
def encode(data: LongLat): RespCommand =
366+
RespCommand(
367+
RespCommandArgument.Literal("FROMLONLAT"),
368+
RespCommandArgument.Value(data.longitude.toString),
369+
RespCommandArgument.Value(data.latitude.toString)
370+
)
371+
}
372+
354373
final case class MemberScoreInput[M: BinaryCodec]() extends Input[MemberScore[M]] {
355374
def encode(data: MemberScore[M]): RespCommand = {
356375
val score = data.score match {
@@ -448,11 +467,16 @@ object Input {
448467
RespCommand(RespCommandArgument.Literal("STOREDIST"), RespCommandArgument.Value(data.key))
449468
}
450469

451-
case object StoreInput extends Input[Store] {
470+
case object LegacyStoreInput extends Input[Store] {
452471
def encode(data: Store): RespCommand =
453472
RespCommand(RespCommandArgument.Literal("STORE"), RespCommandArgument.Value(data.key))
454473
}
455474

475+
case object StoreInput extends Input[Store] {
476+
def encode(data: Store): RespCommand =
477+
RespCommand(RespCommandArgument.Value(data.key))
478+
}
479+
456480
case object MaxLenApproxInput extends Input[CappedStreamType.MaxLenApprox] {
457481
def encode(data: CappedStreamType.MaxLenApprox): RespCommand = {
458482
val maxLenChunk: Chunk[RespCommandArgument] = Chunk(
@@ -597,6 +621,21 @@ object Input {
597621
_6.encode(data._6) ++ _7.encode(data._7)
598622
}
599623

624+
final case class Tuple8[-A, -B, -C, -D, -E, -F, -G, -H](
625+
_1: Input[A],
626+
_2: Input[B],
627+
_3: Input[C],
628+
_4: Input[D],
629+
_5: Input[E],
630+
_6: Input[F],
631+
_7: Input[G],
632+
_8: Input[H]
633+
) extends Input[(A, B, C, D, E, F, G, H)] {
634+
def encode(data: (A, B, C, D, E, F, G, H)): RespCommand =
635+
_1.encode(data._1) ++ _2.encode(data._2) ++ _3.encode(data._3) ++ _4.encode(data._4) ++ _5.encode(data._5) ++
636+
_6.encode(data._6) ++ _7.encode(data._7) ++ _8.encode(data._8)
637+
}
638+
600639
final case class Tuple9[-A, -B, -C, -D, -E, -F, -G, -H, -I](
601640
_1: Input[A],
602641
_2: Input[B],

0 commit comments

Comments
 (0)