Skip to content

Commit

Permalink
Change Param Names
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherDavenport committed Jan 5, 2022
1 parent d7425ee commit 8de48fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ object RedisCommands {
val default = XAddOpts(None, None, None, false, None, None)
}

def xadd[F[_]: RedisCtx](stream: String, map: List[(String, String)], xaddOpts: XAddOpts = XAddOpts.default): F[String] = {
def xadd[F[_]: RedisCtx](stream: String, body: List[(String, String)], xaddOpts: XAddOpts = XAddOpts.default): F[String] = {
val maxLen = xaddOpts.maxLength.toList.flatMap{ l => List("MAXLEN".some, xaddOpts.trimming.map(_.encode), l.encode.some).flattenOption }
val minId = xaddOpts.minId.toList.flatMap{ l => List("MINID".some, xaddOpts.trimming.map(_.encode), l.encode.some).flattenOption }
val limit = xaddOpts.limit.toList.flatMap(l=> if (xaddOpts.trimming.contains(Trimming.Approximate)) List("LIMIT", l.encode) else List.empty)
val noMkStream = Alternative[List].guard(xaddOpts.noMkStream).as("NOMKSTREAM")
val id = List(xaddOpts.id.getOrElse("*"))
val body = map.foldLeft(List.empty[String]){ case (s, (k,v)) => s ::: List(k.encode, v.encode) }
val bodyEnd = body.foldLeft(List.empty[String]){ case (s, (k,v)) => s ::: List(k.encode, v.encode) }

RedisCtx[F].unkeyed(NEL("XADD", stream :: maxLen ::: minId ::: limit ::: noMkStream ::: id ::: body))
RedisCtx[F].unkeyed(NEL("XADD", stream :: maxLen ::: minId ::: limit ::: noMkStream ::: id ::: bodyEnd))
}

final case class XReadOpts(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait RedisStream[F[_]] {
def append(messages: List[RedisStream.XAddMessage]): F[List[String]]

def read(
keys: Set[String],
streams: Set[String],
chunkSize: Int,
initialOffset: String => StreamOffset = {(s: String) => StreamOffset.All(s)},
block: Duration = Duration.Zero,
Expand Down

0 comments on commit 8de48fe

Please sign in to comment.