io.quarkus.redis.runtime.datasource.AbstractBitMapCommands Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.runtime.datasource;
import static io.quarkus.redis.runtime.datasource.Validation.isBit;
import static io.quarkus.redis.runtime.datasource.Validation.notNullOrEmpty;
import static io.smallrye.mutiny.helpers.ParameterValidation.nonNull;
import java.lang.reflect.Type;
import java.util.List;
import io.quarkus.redis.datasource.bitmap.BitFieldArgs;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Command;
import io.vertx.mutiny.redis.client.Response;
class AbstractBitMapCommands extends AbstractRedisCommands {
AbstractBitMapCommands(RedisCommandExecutor redis, Type k) {
super(redis, new Marshaller(k));
}
Uni _bitcount(K key) {
nonNull(key, "key");
return execute(RedisCommand.of(Command.BITCOUNT).put(marshaller.encode(key)));
}
Uni _bitcount(K key, long start, long end) {
nonNull(key, "key");
return execute(RedisCommand.of(Command.BITCOUNT).put(marshaller.encode(key)).put(start).put(end));
}
Uni _bitfield(K key, BitFieldArgs bitFieldArgs) {
nonNull(key, "key");
nonNull(bitFieldArgs, "bitFieldArgs");
return execute(RedisCommand.of(Command.BITFIELD).put(marshaller.encode(key)).putArgs(bitFieldArgs));
}
Uni _bitpos(K key, int bit) {
nonNull(key, "key");
isBit(bit, "bit");
return execute(RedisCommand.of(Command.BITPOS).put(marshaller.encode(key)).put(bit));
}
Uni _bitpos(K key, int bit, long start) {
nonNull(key, "key");
isBit(bit, "bit");
return execute(RedisCommand.of(Command.BITPOS).put(marshaller.encode(key)).put(bit).put(start));
}
Uni _bitpos(K key, int bit, long start, long end) {
nonNull(key, "key");
return execute(RedisCommand.of(Command.BITPOS).put(marshaller.encode(key)).put(bit).put(start).put(end));
}
Uni _bitopAnd(K destination, K... keys) {
nonNull(destination, "destination");
notNullOrEmpty(keys, "keys");
return execute(RedisCommand.of(Command.BITOP).put("AND")
.put(marshaller.encode(destination)).put(marshaller.encode(keys)));
}
Uni _bitopNot(K destination, K source) {
nonNull(destination, "destination");
nonNull(source, "source");
return execute(RedisCommand.of(Command.BITOP).put("NOT")
.put(marshaller.encode(destination)).put(marshaller.encode(source)));
}
final Uni _bitopOr(K destination, K... keys) {
nonNull(destination, "destination");
notNullOrEmpty(keys, "keys");
return execute(RedisCommand.of(Command.BITOP).put("OR")
.put(marshaller.encode(destination)).put(marshaller.encode(keys)));
}
@SafeVarargs
final Uni _bitopXor(K destination, K... keys) {
nonNull(destination, "destination");
notNullOrEmpty(keys, "keys");
return execute(RedisCommand.of(Command.BITOP).put("XOR")
.put(marshaller.encode(destination)).put(marshaller.encode(keys)));
}
List decodeListOfLongs(Response r) {
return marshaller.decodeAsList(r, Response::toLong);
}
Uni _setbit(K key, long offset, int value) {
nonNull(key, "key");
isBit(value, "value");
return execute(RedisCommand.of(Command.SETBIT).put(marshaller.encode(key)).put(offset).put(value));
}
Uni _getbit(K key, long offset) {
return execute(RedisCommand.of(Command.GETBIT).put(marshaller.encode(key)).put(offset));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy