All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.redis.runtime.datasource.AbstractGraphCommands Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.redis.runtime.datasource;

import static io.smallrye.mutiny.helpers.ParameterValidation.nonNull;

import java.lang.reflect.Type;
import java.time.Duration;

import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Command;
import io.vertx.mutiny.redis.client.Response;

public class AbstractGraphCommands extends AbstractRedisCommands {

    AbstractGraphCommands(RedisCommandExecutor redis, Type k) {
        super(redis, new Marshaller(k));
    }

    Uni _graphDelete(K key) {
        // Validation
        nonNull(key, "key");
        // Create command
        RedisCommand cmd = RedisCommand.of(Command.GRAPH_DELETE)
                .put(marshaller.encode(key));
        return execute(cmd);
    }

    Uni _graphExplain(K key, String query) {
        // Validation
        nonNull(key, "key");
        nonNull(query, "query");
        // Create command
        RedisCommand cmd = RedisCommand.of(Command.GRAPH_EXPLAIN)
                .put(marshaller.encode(key))
                .put(query);
        return execute(cmd);
    }

    Uni _graphList() {
        RedisCommand cmd = RedisCommand.of(Command.GRAPH_LIST);
        return execute(cmd);
    }

    Uni _graphQuery(K key, String query) {

        // Validation
        nonNull(key, "key");
        nonNull(query, "query");
        // Create command
        RedisCommand cmd = RedisCommand.of(Command.GRAPH_QUERY)
                .put(marshaller.encode(key))
                .put(query);
        return execute(cmd);
    }

    Uni _graphQuery(K key, String query, Duration timeout) {
        // Validation
        nonNull(key, "key");
        nonNull(query, "query");
        nonNull(timeout, "timeout");
        // Create command
        RedisCommand cmd = RedisCommand.of(Command.GRAPH_QUERY)
                .put(marshaller.encode(key))
                .put(query)
                .put("TIMEOUT").put(timeout.toMillis());
        return execute(cmd);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy