Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Non Empty #938

Draft
wants to merge 1 commit into
base: series/1.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ trait BitCommands[F[_], K, V] {

def bitField(key: K, operations: BitCommandOperation*): F[List[Long]]

def bitOpAnd(destination: K, sources: K*): F[Unit]
def bitOpAnd(destination: K, source: K, sources: K*): F[Unit]

def bitOpNot(destination: K, source: K): F[Unit]

def bitOpOr(destination: K, sources: K*): F[Unit]
def bitOpOr(destination: K, source: K, sources: K*): F[Unit]

def bitOpXor(destination: K, sources: K*): F[Unit]
def bitOpXor(destination: K, source: K, sources: K*): F[Unit]

def bitPos(key: K, state: Boolean): F[Long]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ trait GeoCommands[F[_], K, V] extends GeoGetter[F, K, V] with GeoSetter[F, K, V]

trait GeoGetter[F[_], K, V] {
def geoDist(key: K, from: V, to: V, unit: GeoArgs.Unit): F[Double]
def geoHash(key: K, values: V*): F[List[Option[String]]]
def geoPos(key: K, values: V*): F[List[GeoCoordinate]]
def geoHash(key: K,value:V, values: V*): F[List[Option[String]]]
def geoPos(key: K,value:V, values: V*): F[List[GeoCoordinate]]
def geoRadius(key: K, geoRadius: GeoRadius, unit: GeoArgs.Unit): F[Set[V]]
def geoRadius(key: K, geoRadius: GeoRadius, unit: GeoArgs.Unit, args: GeoArgs): F[List[GeoRadiusResult[V]]]
def geoRadiusByMember(key: K, value: V, dist: Distance, unit: GeoArgs.Unit): F[Set[V]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import scala.concurrent.duration.FiniteDuration
trait KeyCommands[F[_], K] {
def copy(source: K, destination: K): F[Boolean]
def copy(source: K, destination: K, copyArgs: CopyArgs): F[Boolean]
def del(key: K*): F[Long]
def del(k: K, keys: K*): F[Long]
def dump(key: K): F[Option[Array[Byte]]]
def exists(key: K*): F[Boolean]
def exists(key: K, keys: K*): F[Boolean]
def expire(key: K, expiresIn: FiniteDuration): F[Boolean]
def expire(key: K, expiresIn: FiniteDuration, expireExistenceArg: ExpireExistenceArg): F[Boolean]
def expireAt(key: K, at: Instant): F[Boolean]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ trait SortedSetSetter[F[_], K, V] {
def zAddIncr(key: K, args: Option[ZAddArgs], value: ScoreWithValue[V]): F[Double]
def zIncrBy(key: K, member: V, amount: Double): F[Double]
def zInterStore(destination: K, args: Option[ZStoreArgs], keys: K*): F[Long]
def zRem(key: K, values: V*): F[Long]
def zRem(key: K, value: V, values: V*): F[Long]
def zRemRangeByLex(key: K, range: ZRange[V]): F[Long]
def zRemRangeByRank(key: K, start: Long, stop: Long): F[Long]
def zRemRangeByScore[T: Numeric](key: K, range: ZRange[T]): F[Long]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,16 @@ private[redis4cats] class BaseRedis[F[_]: FutureLift: MonadThrow: Log, K, V](
override def copy(source: K, destination: K, copyArgs: CopyArgs): F[Boolean] =
async.flatMap(_.copy(source, destination, copyArgs.asJava).futureLift.map(x => Boolean.box(x)))

def del(key: K*): F[Long] =
async.flatMap(_.del(key: _*).futureLift.map(x => Long.box(x)))
def del(k: K, keys: K*): F[Long] =
async.flatMap(_.del((k +: keys): _*).futureLift.map(x => Long.box(x)))

override def dump(key: K): F[Option[Array[Byte]]] =
async.flatMap(_.dump(key).futureLift.map(Option(_)))

override def exists(key: K*): F[Boolean] =
async.flatMap(_.exists(key: _*).futureLift.map(_ == key.size.toLong))
override def exists(key: K, keys: K*): F[Boolean] = {
val all = key +: keys
async.flatMap(_.exists(all: _*).futureLift.map(_ == all.size.toLong))
}

/**
* Expires a key with the given duration. If specified either in MILLISECONDS, MICROSECONDS or NANOSECONDS,
Expand Down Expand Up @@ -948,17 +950,17 @@ private[redis4cats] class BaseRedis[F[_]: FutureLift: MonadThrow: Log, K, V](
override def bitPos(key: K, state: Boolean, start: Long, end: Long): F[Long] =
async.flatMap(_.bitpos(key, state, start, end).futureLift.map(x => Long.box(x)))

override def bitOpAnd(destination: K, sources: K*): F[Unit] =
async.flatMap(_.bitopAnd(destination, sources: _*).futureLift.void)
override def bitOpAnd(destination: K, source: K, sources: K*): F[Unit] =
async.flatMap(_.bitopAnd(destination, (source +: sources): _*).futureLift.void)

override def bitOpNot(destination: K, source: K): F[Unit] =
async.flatMap(_.bitopNot(destination, source).futureLift.void)

override def bitOpOr(destination: K, sources: K*): F[Unit] =
async.flatMap(_.bitopOr(destination, sources: _*).futureLift.void)
override def bitOpOr(destination: K, source: K, sources: K*): F[Unit] =
async.flatMap(_.bitopOr(destination, (source +: sources): _*).futureLift.void)

override def bitOpXor(destination: K, sources: K*): F[Unit] =
async.flatMap(_.bitopXor(destination, sources: _*).futureLift.void)
override def bitOpXor(destination: K, source: K, sources: K*): F[Unit] =
async.flatMap(_.bitopXor(destination, (source +: sources): _*).futureLift.void)

override def getBit(key: K, offset: Long): F[Option[Long]] =
async.flatMap(_.getbit(key, offset).futureLift.map(x => Option(Long.unbox(x))))
Expand All @@ -970,14 +972,14 @@ private[redis4cats] class BaseRedis[F[_]: FutureLift: MonadThrow: Log, K, V](
override def geoDist(key: K, from: V, to: V, unit: GeoArgs.Unit): F[Double] =
async.flatMap(_.geodist(key, from, to, unit).futureLift.map(x => Double.box(x)))

override def geoHash(key: K, values: V*): F[List[Option[String]]] =
override def geoHash(key: K, value: V, values: V*): F[List[Option[String]]] =
async
.flatMap(_.geohash(key, values: _*).futureLift)
.flatMap(_.geohash(key, (value +: values): _*).futureLift)
.map(_.asScala.toList.map(x => Option(x.getValue)))

override def geoPos(key: K, values: V*): F[List[GeoCoordinate]] =
override def geoPos(key: K, value: V, values: V*): F[List[GeoCoordinate]] =
async
.flatMap(_.geopos(key, values: _*).futureLift)
.flatMap(_.geopos(key, (value +: values): _*).futureLift)
.map(_.asScala.toList.map(c => GeoCoordinate(c.getX.doubleValue(), c.getY.doubleValue())))

override def geoRadius(key: K, geoRadius: GeoRadius, unit: GeoArgs.Unit): F[Set[V]] =
Expand Down Expand Up @@ -1081,8 +1083,8 @@ private[redis4cats] class BaseRedis[F[_]: FutureLift: MonadThrow: Log, K, V](
res.map(x => Long.box(x))
}

override def zRem(key: K, values: V*): F[Long] =
async.flatMap(_.zrem(key, values: _*).futureLift.map(x => Long.box(x)))
override def zRem(key: K, value: V, values: V*): F[Long] =
async.flatMap(_.zrem(key, (value +: values): _*).futureLift.map(x => Long.box(x)))

override def zRemRangeByLex(key: K, range: ZRange[V]): F[Long] =
async
Expand Down