Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package io.reactiverse.mutiny.pgclient;
import java.util.Map;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import java.util.function.Consumer;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Publisher;
import io.reactiverse.pgclient.PgNotification;
import java.util.List;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
/**
* A connection to Postgres.
*
*
* NOTE: This class has been automatically generated from the {@link io.reactiverse.pgclient.PgConnection original} non Mutiny-ified interface using Vert.x codegen.
*/
@io.smallrye.mutiny.vertx.MutinyGen(io.reactiverse.pgclient.PgConnection.class)
public class PgConnection extends io.reactiverse.mutiny.pgclient.PgClient {
public static final io.smallrye.mutiny.vertx.TypeArg __TYPE_ARG = new io.smallrye.mutiny.vertx.TypeArg<>( obj -> new PgConnection((io.reactiverse.pgclient.PgConnection) obj),
PgConnection::getDelegate
);
private final io.reactiverse.pgclient.PgConnection delegate;
public PgConnection(io.reactiverse.pgclient.PgConnection delegate) {
super(delegate);
this.delegate = delegate;
}
/**
* Empty constructor used by CDI, do not use this constructor directly.
**/
PgConnection() { super(null);
this.delegate = null;
}
public io.reactiverse.pgclient.PgConnection getDelegate() {
return delegate;
}
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PgConnection that = (PgConnection) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* Create a prepared query.
* @param sql the sql
* @param handler the handler notified with the prepared query asynchronously
* @return
*/
private io.reactiverse.mutiny.pgclient.PgConnection __prepare(String sql, Handler> handler) {
delegate.prepare(sql, new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.reactiverse.mutiny.pgclient.PgPreparedQuery.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
/**
* Create a prepared query.
* @param sql the sql
* @return
*/
public Uni prepare(String sql) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__prepare(sql, handler);
});
}
/**
* Create a prepared query.
* @param sql the sql
* @return
*/
public io.reactiverse.mutiny.pgclient.PgPreparedQuery prepareAndAwait(String sql) {
return (io.reactiverse.mutiny.pgclient.PgPreparedQuery) prepare(sql).await().indefinitely();
}
/**
* Set an handler called with connection errors.
* @param handler the handler
* @return a reference to this, so the API can be used fluently
*/
private io.reactiverse.mutiny.pgclient.PgConnection __exceptionHandler(Handler handler) {
delegate.exceptionHandler(handler);
return this;
}
/**
* Set an handler called with connection errors.
* @param handler the handler
* @return a reference to this, so the API can be used fluently
*/
public io.reactiverse.mutiny.pgclient.PgConnection exceptionHandler(Consumer handler) {
return __exceptionHandler(handler != null ? handler::accept : null);
}
/**
* Set an handler called when the connection is closed.
* @param handler the handler
* @return a reference to this, so the API can be used fluently
*/
private io.reactiverse.mutiny.pgclient.PgConnection __closeHandler(Handler handler) {
delegate.closeHandler(handler);
return this;
}
/**
* Set an handler called when the connection is closed.
* @param handler the handler
* @return a reference to this, so the API can be used fluently
*/
public io.reactiverse.mutiny.pgclient.PgConnection closeHandler(Consumer handler) {
return __closeHandler(handler != null ? handler::accept : null);
}
/**
* Begin a transaction and returns a {@link io.reactiverse.mutiny.pgclient.PgTransaction} for controlling and tracking
* this transaction.
*
* When the connection is explicitely closed, any inflight transaction is rollbacked.
* @return the transaction instance
*/
public io.reactiverse.mutiny.pgclient.PgTransaction begin() {
io.reactiverse.mutiny.pgclient.PgTransaction ret = io.reactiverse.mutiny.pgclient.PgTransaction.newInstance(delegate.begin());
return ret;
}
/**
* Set an handler called when the connection receives notification on a channel.
*
* The handler is called with the {@link io.reactiverse.pgclient.PgNotification} and has access to the channel name
* and the notification payload.
* @param handler the handler
* @return the transaction instance
*/
private io.reactiverse.mutiny.pgclient.PgConnection __notificationHandler(Handler handler) {
delegate.notificationHandler(handler);
return this;
}
/**
* Set an handler called when the connection receives notification on a channel.
*
* The handler is called with the {@link io.reactiverse.pgclient.PgNotification} and has access to the channel name
* and the notification payload.
* @param handler the handler
* @return the transaction instance
*/
public io.reactiverse.mutiny.pgclient.PgConnection notificationHandler(Consumer handler) {
return __notificationHandler(handler != null ? handler::accept : null);
}
/**
* @return The process ID of the target backend
*/
public int processId() {
int ret = delegate.processId();
return ret;
}
/**
* @return The secret key for the target backend
*/
public int secretKey() {
int ret = delegate.secretKey();
return ret;
}
/**
* Send a request cancellation message to tell the server to cancel processing request in this connection.
* Note: Use this with caution because the cancellation signal may or may not have any effect.
* @param handler the handler notified if cancelling request is sent
* @return a reference to this, so the API can be used fluently
*/
private io.reactiverse.mutiny.pgclient.PgConnection __cancelRequest(Handler> handler) {
io.reactiverse.mutiny.pgclient.PgConnection ret = io.reactiverse.mutiny.pgclient.PgConnection.newInstance(delegate.cancelRequest(handler));
return ret;
}
/**
* Send a request cancellation message to tell the server to cancel processing request in this connection.
* Note: Use this with caution because the cancellation signal may or may not have any effect.
* @return a reference to this, so the API can be used fluently
*/
public Uni cancelRequest() {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__cancelRequest(handler);
});
}
/**
* Send a request cancellation message to tell the server to cancel processing request in this connection.
* Note: Use this with caution because the cancellation signal may or may not have any effect.
* @return a reference to this, so the API can be used fluently
*/
public Void cancelRequestAndAwait() {
return (Void) cancelRequest().await().indefinitely();
}
/**
* @return whether the connection uses SSL
*/
public boolean isSSL() {
boolean ret = delegate.isSSL();
return ret;
}
/**
* Close the current connection after all the pending commands have been processed.
*/
public void close() {
delegate.close();
}
private io.reactiverse.mutiny.pgclient.PgConnection __preparedQuery(String sql, Handler> handler) {
delegate.preparedQuery(sql, new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.reactiverse.mutiny.pgclient.PgRowSet.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
public Uni preparedQuery(String sql) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__preparedQuery(sql, handler);
});
}
public io.reactiverse.mutiny.pgclient.PgRowSet preparedQueryAndAwait(String sql) {
return (io.reactiverse.mutiny.pgclient.PgRowSet) preparedQuery(sql).await().indefinitely();
}
private io.reactiverse.mutiny.pgclient.PgConnection __query(String sql, Handler> handler) {
delegate.query(sql, new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.reactiverse.mutiny.pgclient.PgRowSet.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
public Uni query(String sql) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__query(sql, handler);
});
}
public io.reactiverse.mutiny.pgclient.PgRowSet queryAndAwait(String sql) {
return (io.reactiverse.mutiny.pgclient.PgRowSet) query(sql).await().indefinitely();
}
private io.reactiverse.mutiny.pgclient.PgConnection __preparedQuery(String sql, io.reactiverse.mutiny.pgclient.Tuple arguments, Handler> handler) {
delegate.preparedQuery(sql, arguments.getDelegate(), new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.reactiverse.mutiny.pgclient.PgRowSet.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
public Uni preparedQuery(String sql, io.reactiverse.mutiny.pgclient.Tuple arguments) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__preparedQuery(sql, arguments, handler);
});
}
public io.reactiverse.mutiny.pgclient.PgRowSet preparedQueryAndAwait(String sql, io.reactiverse.mutiny.pgclient.Tuple arguments) {
return (io.reactiverse.mutiny.pgclient.PgRowSet) preparedQuery(sql, arguments).await().indefinitely();
}
private io.reactiverse.mutiny.pgclient.PgConnection __preparedBatch(String sql, List batch, Handler> handler) {
delegate.preparedBatch(sql, batch.stream().map(elt -> elt.getDelegate()).collect(java.util.stream.Collectors.toList()), new Handler>() {
public void handle(AsyncResult ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.reactiverse.mutiny.pgclient.PgRowSet.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
public Uni preparedBatch(String sql, List batch) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__preparedBatch(sql, batch, handler);
});
}
public io.reactiverse.mutiny.pgclient.PgRowSet preparedBatchAndAwait(String sql, List batch) {
return (io.reactiverse.mutiny.pgclient.PgRowSet) preparedBatch(sql, batch).await().indefinitely();
}
public static PgConnection newInstance(io.reactiverse.pgclient.PgConnection arg) {
return arg != null ? new PgConnection(arg) : null;
}
}