未验证 提交 89daa306 编写于 作者: M Mika'il Khan 提交者: GitHub

add migrate, randomkey, restore and wait keys (#51)

上级 cf1c8fc4
/.idea/
/.bloop
target/
......@@ -10,7 +10,9 @@ import scala.util.matching.Regex
sealed trait Input[-A]
object Input {
case object AbsTtlInput extends Input[AbsTtl]
case object AggregateInput extends Input[Aggregate]
case object AuthInput extends Input[Auth]
case object BoolInput extends Input[Boolean]
case object BitFieldGetInput extends Input[BitFieldGet]
case object BitFieldSetInput extends Input[BitFieldSet]
......@@ -20,9 +22,12 @@ object Input {
case object BitPosRangeInput extends Input[BitPosRange]
case object ByteInput extends Input[Chunk[Byte]]
case object ChangedInput extends Input[Changed]
case object CopyInput extends Input[Copy]
case object CountInput extends Input[Count]
case object DoubleInput extends Input[Double]
case object DurationInput extends Input[Duration]
case object FreqInput extends Input[Freq]
case object IdleTimeInput extends Input[IdleTime]
case object IncrementInput extends Input[Increment]
case object KeepTtlInput extends Input[KeepTtl]
case object LexRangeInput extends Input[LexRange]
......@@ -38,6 +43,8 @@ object Input {
case object RadiusUnitInput extends Input[RadiusUnit]
case object RangeInput extends Input[Range]
case object RegexInput extends Input[Regex]
case object ReplaceInput extends Input[Replace]
case object StoreDistInput extends Input[StoreDist]
case object StoreInput extends Input[Store]
case object ScoreRangeInput extends Input[ScoreRange]
......@@ -57,6 +64,28 @@ object Input {
final case class Tuple5[-A, -B, -C, -D, -E](_1: Input[A], _2: Input[B], _3: Input[C], _4: Input[D], _5: Input[E])
extends Input[(A, B, C, D, E)]
final case class Tuple7[-A, -B, -C, -D, -E, -F, -G](
_1: Input[A],
_2: Input[B],
_3: Input[C],
_4: Input[D],
_5: Input[E],
_6: Input[F],
_7: Input[G]
) extends Input[(A, B, C, D, E, F, G)]
final case class Tuple9[-A, -B, -C, -D, -E, -F, -G, -H, -I](
_1: Input[A],
_2: Input[B],
_3: Input[C],
_4: Input[D],
_5: Input[E],
_6: Input[F],
_7: Input[G],
_8: Input[H],
_9: Input[I]
) extends Input[(A, B, C, D, E, F, G, H, I)]
final case class Tuple11[-A, -B, -C, -D, -E, -F, -G, -H, -I, -J, -K](
_1: Input[A],
_2: Input[B],
......
package zio.redis.api
import zio.redis.RedisCommand
import zio.redis.Input._
import zio.redis.Output._
import zio.redis.RedisCommand
trait Keys {
final val del = RedisCommand("DEL", NonEmptyList(StringInput), LongOutput)
......@@ -11,15 +11,44 @@ trait Keys {
final val expire = RedisCommand("EXPIRE", Tuple2(StringInput, DurationInput), BoolOutput)
final val expireAt = RedisCommand("EXPIREAT", Tuple2(StringInput, TimeInput), BoolOutput)
final val keys = RedisCommand("KEYS", StringInput, ChunkOutput)
final val migrate = RedisCommand(
"MIGRATE",
Tuple9(
StringInput,
LongInput,
StringInput,
LongInput,
LongInput,
OptionalInput(CopyInput),
OptionalInput(ReplaceInput),
OptionalInput(AuthInput),
OptionalInput(NonEmptyList(StringInput))
),
StringOutput
)
final val move = RedisCommand("MOVE", Tuple2(StringInput, LongInput), BoolOutput)
final val persist = RedisCommand("PERSIST", StringInput, BoolOutput)
final val pExpire = RedisCommand("PEXPIRE", Tuple2(StringInput, DurationInput), BoolOutput)
final val pExpireAt = RedisCommand("PEXPIREAT", Tuple2(StringInput, TimeInput), BoolOutput)
final val pTtl = RedisCommand("PTTL", StringInput, DurationOutput)
final val randomKey = RedisCommand("RANDOMKEY", NoInput, ByteOutput)
final val rename = RedisCommand("RENAME", Tuple2(StringInput, StringInput), UnitOutput)
final val renameNx = RedisCommand("RENAMENX", Tuple2(StringInput, StringInput), BoolOutput)
final val scan = RedisCommand(
final val restore = RedisCommand(
"RESTORE",
Tuple7(
StringInput,
LongInput,
ByteInput,
OptionalInput(ReplaceInput),
OptionalInput(AbsTtlInput),
OptionalInput(IdleTimeInput),
OptionalInput(FreqInput)
),
StringOutput
)
final val scan = RedisCommand(
"SCAN",
Tuple4(LongInput, OptionalInput(RegexInput), OptionalInput(LongInput), OptionalInput(StringInput)),
ScanOutput
......@@ -29,4 +58,5 @@ trait Keys {
final val ttl = RedisCommand("TTL", StringInput, DurationOutput)
final val typeOf = RedisCommand("TYPE", StringInput, StringOutput)
final val unlink = RedisCommand("UNLINK", NonEmptyList(StringInput), LongOutput)
final val wait_ = RedisCommand("WAIT", Tuple2(LongInput, LongInput), LongOutput)
}
package zio.redis.options
trait Keys {
case object AbsTtl
type AbsTtl = AbsTtl.type
case object Alpha
type Alpha = Alpha.type
sealed case class Auth(password: String)
sealed case class By(pattern: String)
case object Copy
type Copy = Copy.type
sealed case class IdleTime(seconds: Long)
sealed case class Freq(frequency: String)
case object Replace
type Replace = Replace.type
}
package zio.redis.options
trait Shared {
sealed case class Limit(offset: Int, count: Int)
sealed trait Update
object Update {
......
......@@ -33,8 +33,6 @@ trait SortedSets {
sealed case class LexRange(min: LexMinimum, max: LexMaximum)
sealed case class Limit(offset: Long, count: Long)
sealed case class MemberScore(score: Double, member: String)
sealed trait ScoreMaximum
......
......@@ -12,6 +12,7 @@ package object redis
with api.SortedSets
with api.Transactions
with options.Geo
with options.Keys
with options.Shared
with options.SortedSets
with options.Strings
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册