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

io.vertx.rxjava.ext.asyncsql.PostgreSQLClient Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava.ext.asyncsql;

import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * Represents an PostgreSQL client
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.ext.asyncsql.PostgreSQLClient original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.ext.asyncsql.PostgreSQLClient.class) public class PostgreSQLClient extends io.vertx.rxjava.ext.asyncsql.AsyncSQLClient { @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; PostgreSQLClient that = (PostgreSQLClient) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new PostgreSQLClient((io.vertx.ext.asyncsql.PostgreSQLClient) obj), PostgreSQLClient::getDelegate ); private final io.vertx.ext.asyncsql.PostgreSQLClient delegate; public PostgreSQLClient(io.vertx.ext.asyncsql.PostgreSQLClient delegate) { super(delegate); this.delegate = delegate; } public PostgreSQLClient(Object delegate) { super((io.vertx.ext.asyncsql.PostgreSQLClient)delegate); this.delegate = (io.vertx.ext.asyncsql.PostgreSQLClient)delegate; } public io.vertx.ext.asyncsql.PostgreSQLClient getDelegate() { return delegate; } /** * Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by * getting a connection from the pool (this object) and return it back after the execution. Only the first result * from the result set is returned. * @param sql the statement to execute * @param handler the result handler * @return self */ public io.vertx.rxjava.ext.sql.SQLOperations querySingle(String sql, Handler> handler) { delegate.querySingle(sql, handler); return this; } /** * Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by * getting a connection from the pool (this object) and return it back after the execution. Only the first result * from the result set is returned. * @param sql the statement to execute * @return self * @deprecated use {@link #rxQuerySingle} instead */ @Deprecated() public Observable querySingleObservable(String sql) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); querySingle(sql, handler.toHandler()); return handler; } /** * Execute a one shot SQL statement that returns a single SQL row. This method will reduce the boilerplate code by * getting a connection from the pool (this object) and return it back after the execution. Only the first result * from the result set is returned. * @param sql the statement to execute * @return self */ public Single rxQuerySingle(String sql) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { querySingle(sql, fut); })); } /** * Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the * boilerplate code by getting a connection from the pool (this object) and return it back after the execution. * Only the first result from the result set is returned. * @param sql the statement to execute * @param arguments the arguments * @param handler the result handler * @return self */ public io.vertx.rxjava.ext.sql.SQLOperations querySingleWithParams(String sql, JsonArray arguments, Handler> handler) { delegate.querySingleWithParams(sql, arguments, handler); return this; } /** * Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the * boilerplate code by getting a connection from the pool (this object) and return it back after the execution. * Only the first result from the result set is returned. * @param sql the statement to execute * @param arguments the arguments * @return self * @deprecated use {@link #rxQuerySingleWithParams} instead */ @Deprecated() public Observable querySingleWithParamsObservable(String sql, JsonArray arguments) { io.vertx.rx.java.ObservableFuture handler = io.vertx.rx.java.RxHelper.observableFuture(); querySingleWithParams(sql, arguments, handler.toHandler()); return handler; } /** * Execute a one shot SQL statement with arguments that returns a single SQL row. This method will reduce the * boilerplate code by getting a connection from the pool (this object) and return it back after the execution. * Only the first result from the result set is returned. * @param sql the statement to execute * @param arguments the arguments * @return self */ public Single rxQuerySingleWithParams(String sql, JsonArray arguments) { return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> { querySingleWithParams(sql, arguments, fut); })); } /** * Create a PostgreSQL client which maintains its own pool. * @param vertx the Vert.x instance * @param config the configuration * @return the client */ public static io.vertx.rxjava.ext.asyncsql.AsyncSQLClient createNonShared(io.vertx.rxjava.core.Vertx vertx, JsonObject config) { io.vertx.rxjava.ext.asyncsql.AsyncSQLClient ret = io.vertx.rxjava.ext.asyncsql.AsyncSQLClient.newInstance((io.vertx.ext.asyncsql.AsyncSQLClient)io.vertx.ext.asyncsql.PostgreSQLClient.createNonShared(vertx.getDelegate(), config)); return ret; } /** * Create a PostgreSQL client which shares its pool with any other MySQL clients created with the same pool name. * @param vertx the Vert.x instance * @param config the configuration * @param poolName the pool name * @return the client */ public static io.vertx.rxjava.ext.asyncsql.AsyncSQLClient createShared(io.vertx.rxjava.core.Vertx vertx, JsonObject config, String poolName) { io.vertx.rxjava.ext.asyncsql.AsyncSQLClient ret = io.vertx.rxjava.ext.asyncsql.AsyncSQLClient.newInstance((io.vertx.ext.asyncsql.AsyncSQLClient)io.vertx.ext.asyncsql.PostgreSQLClient.createShared(vertx.getDelegate(), config, poolName)); return ret; } /** * Like {@link io.vertx.rxjava.ext.asyncsql.PostgreSQLClient#createShared} but with the default pool name * @param vertx the Vert.x instance * @param config the configuration * @return the client */ public static io.vertx.rxjava.ext.asyncsql.AsyncSQLClient createShared(io.vertx.rxjava.core.Vertx vertx, JsonObject config) { io.vertx.rxjava.ext.asyncsql.AsyncSQLClient ret = io.vertx.rxjava.ext.asyncsql.AsyncSQLClient.newInstance((io.vertx.ext.asyncsql.AsyncSQLClient)io.vertx.ext.asyncsql.PostgreSQLClient.createShared(vertx.getDelegate(), config)); return ret; } /** * The default name used for the PostGreSQL pool. */ public static final String DEFAULT_DS_NAME = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_DS_NAME; /** * The default host. */ public static final String DEFAULT_HOST = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_HOST; /** * The default port. */ public static final int DEFAULT_PORT = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_PORT; /** * The default database name. */ public static final String DEFAULT_DATABASE = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_DATABASE; /** * The default database user. */ public static final String DEFAULT_USER = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_USER; /** * The default user password. */ public static final String DEFAULT_PASSWORD = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_PASSWORD; /** * The default charset. */ public static final String DEFAULT_CHARSET = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_CHARSET; /** * The default timeout for connect. */ public static final long DEFAULT_CONNECT_TIMEOUT = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_CONNECT_TIMEOUT; /** * The default timeout for tests. */ public static final long DEFAULT_TEST_TIMEOUT = io.vertx.ext.asyncsql.PostgreSQLClient.DEFAULT_TEST_TIMEOUT; public static PostgreSQLClient newInstance(io.vertx.ext.asyncsql.PostgreSQLClient arg) { return arg != null ? new PostgreSQLClient(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy