Skip to content

Commit

Permalink
Rename stringify to asString
Browse files Browse the repository at this point in the history
  • Loading branch information
mijicd committed Mar 29, 2023
1 parent 5e1a051 commit c87b77c
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 115 deletions.
70 changes: 35 additions & 35 deletions redis/src/main/scala/zio/redis/Input.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ private[redis] object Input {

case object AbsTtlInput extends Input[AbsTtl] {
def encode(data: AbsTtl): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object AddressInput extends Input[Address] {
def encode(data: Address): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

case object AggregateInput extends Input[Aggregate] {
def encode(data: Aggregate): RespCommand =
RespCommand(RespCommandArgument.Literal("AGGREGATE"), RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal("AGGREGATE"), RespCommandArgument.Literal(data.asString))
}

case object AlphaInput extends Input[Alpha] {
def encode(data: Alpha): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object AuthInput extends Input[Auth] {
Expand Down Expand Up @@ -97,33 +97,33 @@ private[redis] object Input {
case BitFieldGet(t, o) =>
Chunk(
RespCommandArgument.Literal("GET"),
RespCommandArgument.Unknown(t.stringify),
RespCommandArgument.Unknown(t.asString),
RespCommandArgument.Unknown(o.toString)
)
case BitFieldSet(t, o, v) =>
Chunk(
RespCommandArgument.Literal("SET"),
RespCommandArgument.Unknown(t.stringify),
RespCommandArgument.Unknown(t.asString),
RespCommandArgument.Unknown(o.toString),
RespCommandArgument.Unknown(v.toString)
)
case BitFieldIncr(t, o, i) =>
Chunk(
RespCommandArgument.Literal("INCRBY"),
RespCommandArgument.Unknown(t.stringify),
RespCommandArgument.Unknown(t.asString),
RespCommandArgument.Unknown(o.toString),
RespCommandArgument.Unknown(i.toString)
)
case bfo: BitFieldOverflow =>
Chunk(RespCommandArgument.Literal("OVERFLOW"), RespCommandArgument.Literal(bfo.stringify))
Chunk(RespCommandArgument.Literal("OVERFLOW"), RespCommandArgument.Literal(bfo.asString))
}
RespCommand(respArgs)
}
}

case object BitOperationInput extends Input[BitOperation] {
def encode(data: BitOperation): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object BitPosRangeInput extends Input[BitPosRange] {
Expand All @@ -141,19 +141,19 @@ private[redis] object Input {

case object ChangedInput extends Input[Changed] {
def encode(data: Changed): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object ClientKillInput extends Input[ClientKillFilter] {
def encode(data: ClientKillFilter): RespCommand = data match {
case addr: ClientKillFilter.Address =>
RespCommand(RespCommandArgument.Literal("ADDR"), RespCommandArgument.Unknown(addr.stringify))
RespCommand(RespCommandArgument.Literal("ADDR"), RespCommandArgument.Unknown(addr.asString))
case laddr: ClientKillFilter.LocalAddress =>
RespCommand(RespCommandArgument.Literal("LADDR"), RespCommandArgument.Unknown(laddr.stringify))
RespCommand(RespCommandArgument.Literal("LADDR"), RespCommandArgument.Unknown(laddr.asString))
case ClientKillFilter.Id(clientId) =>
RespCommand(RespCommandArgument.Literal("ID"), RespCommandArgument.Unknown(clientId.toString))
case ClientKillFilter.Type(clientType) =>
RespCommand(RespCommandArgument.Literal("TYPE"), RespCommandArgument.Literal(clientType.stringify))
RespCommand(RespCommandArgument.Literal("TYPE"), RespCommandArgument.Literal(clientType.asString))
case ClientKillFilter.User(username) =>
RespCommand(RespCommandArgument.Literal("USER"), RespCommandArgument.Unknown(username))
case ClientKillFilter.SkipMe(skip) =>
Expand All @@ -163,7 +163,7 @@ private[redis] object Input {

case object ClientPauseModeInput extends Input[ClientPauseMode] {
def encode(data: ClientPauseMode): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object ClientTrackingInput
Expand Down Expand Up @@ -198,7 +198,7 @@ private[redis] object Input {

case object CopyInput extends Input[Copy] {
def encode(data: Copy): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object CountInput extends Input[Count] {
Expand All @@ -208,7 +208,7 @@ private[redis] object Input {

case object RedisTypeInput extends Input[RedisType] {
def encode(data: RedisType): RespCommand =
RespCommand(RespCommandArgument.Literal("TYPE"), RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal("TYPE"), RespCommandArgument.Literal(data.asString))
}

case object PatternInput extends Input[Pattern] {
Expand All @@ -223,12 +223,12 @@ private[redis] object Input {

case object PositionInput extends Input[Position] {
def encode(data: Position): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object SideInput extends Input[Side] {
def encode(data: Side): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object DoubleInput extends Input[Double] {
Expand Down Expand Up @@ -267,12 +267,12 @@ private[redis] object Input {

case object IncrementInput extends Input[Increment] {
def encode(data: Increment): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object KeepTtlInput extends Input[KeepTtl] {
def encode(data: KeepTtl): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object LimitInput extends Input[Limit] {
Expand Down Expand Up @@ -313,12 +313,12 @@ private[redis] object Input {

case object OrderInput extends Input[Order] {
def encode(data: Order): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

case object RadiusUnitInput extends Input[RadiusUnit] {
def encode(data: RadiusUnit): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

case object RangeInput extends Input[Range] {
Expand All @@ -328,7 +328,7 @@ private[redis] object Input {

case object ReplaceInput extends Input[Replace] {
def encode(data: Replace): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object StoreDistInput extends Input[StoreDist] {
Expand Down Expand Up @@ -415,7 +415,7 @@ private[redis] object Input {
RespCommandArgument.Unknown(data.id)
)

RespCommand(if (data.mkStream) chunk :+ RespCommandArgument.Literal(MkStream.stringify) else chunk)
RespCommand(if (data.mkStream) chunk :+ RespCommandArgument.Literal(MkStream.asString) else chunk)
}
}

Expand Down Expand Up @@ -478,7 +478,7 @@ private[redis] object Input {

case object NoAckInput extends Input[NoAck] {
def encode(data: NoAck): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

case object StreamMaxLenInput extends Input[StreamMaxLen] {
Expand Down Expand Up @@ -605,7 +605,7 @@ private[redis] object Input {

case object UpdateInput extends Input[Update] {
def encode(data: Update): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

final case class GetExPersistInput[K: BinaryCodec]() extends Input[(K, Boolean)] {
Expand Down Expand Up @@ -649,7 +649,7 @@ private[redis] object Input {

case object UnblockBehaviorInput extends Input[UnblockBehavior] {
def encode(data: UnblockBehavior): RespCommand =
RespCommand(RespCommandArgument.Unknown(data.stringify))
RespCommand(RespCommandArgument.Unknown(data.asString))
}

final case class Varargs[-A](input: Input[A]) extends Input[Iterable[A]] {
Expand All @@ -673,42 +673,42 @@ private[redis] object Input {

case object ScriptDebugInput extends Input[DebugMode] {
def encode(data: DebugMode): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object ScriptFlushInput extends Input[FlushMode] {
def encode(data: FlushMode): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithScoresInput extends Input[WithScores] {
def encode(data: WithScores): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithCoordInput extends Input[WithCoord] {
def encode(data: WithCoord): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithDistInput extends Input[WithDist] {
def encode(data: WithDist): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithHashInput extends Input[WithHash] {
def encode(data: WithHash): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithForceInput extends Input[WithForce] {
def encode(data: WithForce): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object WithJustIdInput extends Input[WithJustId] {
def encode(data: WithJustId): RespCommand =
RespCommand(RespCommandArgument.Literal(data.stringify))
RespCommand(RespCommandArgument.Literal(data.asString))
}

case object YesNoInput extends Input[Boolean] {
Expand Down
8 changes: 4 additions & 4 deletions redis/src/main/scala/zio/redis/api/Cluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ trait Cluster extends RedisEnvironment {
final def setSlotStable(slot: Slot): IO[RedisError, Unit] = {
val command =
RedisCommand(ClusterSetSlots, Tuple2(LongInput, ArbitraryValueInput[String]()), UnitOutput, executor)
command.run((slot.number, Stable.stringify))
command.run((slot.number, Stable.asString))
}

/**
Expand All @@ -79,7 +79,7 @@ trait Cluster extends RedisEnvironment {
UnitOutput,
executor
)
command.run((slot.number, Migrating.stringify, nodeId))
command.run((slot.number, Migrating.asString, nodeId))
}

/**
Expand All @@ -100,7 +100,7 @@ trait Cluster extends RedisEnvironment {
UnitOutput,
executor
)
command.run((slot.number, Importing.stringify, nodeId))
command.run((slot.number, Importing.asString, nodeId))
}

/**
Expand All @@ -121,7 +121,7 @@ trait Cluster extends RedisEnvironment {
UnitOutput,
executor
)
command.run((slot.number, Node.stringify, nodeId))
command.run((slot.number, Node.asString, nodeId))
}
}

Expand Down
Loading

0 comments on commit c87b77c

Please sign in to comment.