- java.lang.Object
-
- io.vertx.sqlclient.SqlConnectOptions
-
- io.vertx.pgclient.PgConnectOptions
-
public class PgConnectOptions extends SqlConnectOptions
- Author:
- Julien Viet, Billy Yuan
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DATABASEstatic StringDEFAULT_HOSTstatic StringDEFAULT_PASSWORDstatic intDEFAULT_PIPELINING_LIMITstatic intDEFAULT_PORTstatic Map<String,String>DEFAULT_PROPERTIESstatic SslModeDEFAULT_SSLMODEstatic booleanDEFAULT_USE_LAYER_7_PROXYstatic StringDEFAULT_USER-
Fields inherited from class io.vertx.sqlclient.SqlConnectOptions
DEFAULT_CACHE_PREPARED_STATEMENTS, DEFAULT_METRICS_NAME, DEFAULT_PREPARED_STATEMENT_CACHE_FILTER, DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE, DEFAULT_PREPARED_STATEMENT_CACHE_SQL_LIMIT, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_INTERVAL
-
-
Constructor Summary
Constructors Constructor Description PgConnectOptions()PgConnectOptions(JsonObject json)PgConnectOptions(PgConnectOptions other)PgConnectOptions(SqlConnectOptions other)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgConnectOptionsaddProperty(String key, String value)booleanequals(Object o)static PgConnectOptionsfromEnv()Provide aPgConnectOptionsconfigured with environment variables, if the environment variable is not set, then a default value will take precedence over this.static PgConnectOptionsfromUri(String connectionUri)Provide aPgConnectOptionsconfigured from a connection URI.intgetPipeliningLimit()SocketAddressgetSocketAddress()SslModegetSslMode()booleangetUseLayer7Proxy()inthashCode()protected voidinit()Initialize with the default options.booleanisUsingDomainSocket()PgConnectOptionsmerge(JsonObject other)PgConnectOptionssetCachePreparedStatements(boolean cachePreparedStatements)PgConnectOptionssetDatabase(String database)PgConnectOptionssetHost(String host)PgConnectOptionssetPassword(String password)PgConnectOptionssetPipeliningLimit(int pipeliningLimit)PgConnectOptionssetPort(int port)PgConnectOptionssetPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)PgConnectOptionssetPreparedStatementCacheSqlFilter(Predicate<String> predicate)PgConnectOptionssetPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)PgConnectOptionssetProperties(Map<String,String> properties)PgConnectOptionssetReconnectAttempts(int attempts)PgConnectOptionssetReconnectInterval(long interval)PgConnectOptionssetSslMode(SslMode sslmode)SetSslModefor the client, this option can be used to provide different levels of secure protection.PgConnectOptionssetSslOptions(ClientSSLOptions sslOptions)PgConnectOptionssetTracingPolicy(TracingPolicy tracingPolicy)PgConnectOptionssetUseLayer7Proxy(boolean useLayer7Proxy)Set the client to use a layer 7 (application) proxy compatible protocol, set totruewhen the client interacts with a layer 7 proxy like PgBouncer instead of a server.PgConnectOptionssetUser(String user)JsonObjecttoJson()static PgConnectOptionswrap(SqlConnectOptions options)-
Methods inherited from class io.vertx.sqlclient.SqlConnectOptions
getCachePreparedStatements, getDatabase, getHost, getMetricsName, getPassword, getPort, getPreparedStatementCacheMaxSize, getPreparedStatementCacheSqlFilter, getProperties, getReconnectAttempts, getReconnectInterval, getSslOptions, getTracingPolicy, getUser, setMetricsName
-
-
-
-
Field Detail
-
DEFAULT_HOST
public static final String DEFAULT_HOST
- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static int DEFAULT_PORT
-
DEFAULT_DATABASE
public static final String DEFAULT_DATABASE
- See Also:
- Constant Field Values
-
DEFAULT_USER
public static final String DEFAULT_USER
- See Also:
- Constant Field Values
-
DEFAULT_PASSWORD
public static final String DEFAULT_PASSWORD
- See Also:
- Constant Field Values
-
DEFAULT_PIPELINING_LIMIT
public static final int DEFAULT_PIPELINING_LIMIT
- See Also:
- Constant Field Values
-
DEFAULT_SSLMODE
public static final SslMode DEFAULT_SSLMODE
-
DEFAULT_USE_LAYER_7_PROXY
public static final boolean DEFAULT_USE_LAYER_7_PROXY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PgConnectOptions
public PgConnectOptions()
-
PgConnectOptions
public PgConnectOptions(JsonObject json)
-
PgConnectOptions
public PgConnectOptions(SqlConnectOptions other)
-
PgConnectOptions
public PgConnectOptions(PgConnectOptions other)
-
-
Method Detail
-
wrap
public static PgConnectOptions wrap(SqlConnectOptions options)
- Returns:
- the
optionsas PostgreSQL specific connect options
-
fromUri
public static PgConnectOptions fromUri(String connectionUri) throws IllegalArgumentException
Provide aPgConnectOptionsconfigured from a connection URI.- Parameters:
connectionUri- the connection URI to configure from- Returns:
- a
PgConnectOptionsparsed from the connection URI - Throws:
IllegalArgumentException- when theconnectionUriis in an invalid format
-
fromEnv
public static PgConnectOptions fromEnv()
Provide aPgConnectOptionsconfigured with environment variables, if the environment variable is not set, then a default value will take precedence over this.
-
setHost
public PgConnectOptions setHost(String host)
- Overrides:
setHostin classSqlConnectOptions
-
setPort
public PgConnectOptions setPort(int port)
- Overrides:
setPortin classSqlConnectOptions
-
setUser
public PgConnectOptions setUser(String user)
- Overrides:
setUserin classSqlConnectOptions
-
setPassword
public PgConnectOptions setPassword(String password)
- Overrides:
setPasswordin classSqlConnectOptions
-
setDatabase
public PgConnectOptions setDatabase(String database)
- Overrides:
setDatabasein classSqlConnectOptions
-
getPipeliningLimit
public int getPipeliningLimit()
-
setPipeliningLimit
public PgConnectOptions setPipeliningLimit(int pipeliningLimit)
-
setCachePreparedStatements
public PgConnectOptions setCachePreparedStatements(boolean cachePreparedStatements)
- Overrides:
setCachePreparedStatementsin classSqlConnectOptions
-
setPreparedStatementCacheMaxSize
public PgConnectOptions setPreparedStatementCacheMaxSize(int preparedStatementCacheMaxSize)
- Overrides:
setPreparedStatementCacheMaxSizein classSqlConnectOptions
-
setPreparedStatementCacheSqlFilter
public PgConnectOptions setPreparedStatementCacheSqlFilter(Predicate<String> predicate)
- Overrides:
setPreparedStatementCacheSqlFilterin classSqlConnectOptions
-
setPreparedStatementCacheSqlLimit
public PgConnectOptions setPreparedStatementCacheSqlLimit(int preparedStatementCacheSqlLimit)
- Overrides:
setPreparedStatementCacheSqlLimitin classSqlConnectOptions
-
setProperties
public PgConnectOptions setProperties(Map<String,String> properties)
- Overrides:
setPropertiesin classSqlConnectOptions
-
addProperty
public PgConnectOptions addProperty(String key, String value)
- Overrides:
addPropertyin classSqlConnectOptions
-
getSslMode
public SslMode getSslMode()
- Returns:
- the value of current sslmode
-
setSslMode
public PgConnectOptions setSslMode(SslMode sslmode)
SetSslModefor the client, this option can be used to provide different levels of secure protection.- Parameters:
sslmode- the value of sslmode- Returns:
- a reference to this, so the API can be used fluently
-
getUseLayer7Proxy
@Unstable public boolean getUseLayer7Proxy()
- Returns:
- whether the client interacts with a layer 7 proxy instead of a server
-
setUseLayer7Proxy
@Unstable public PgConnectOptions setUseLayer7Proxy(boolean useLayer7Proxy)
Set the client to use a layer 7 (application) proxy compatible protocol, set totruewhen the client interacts with a layer 7 proxy like PgBouncer instead of a server. Prepared statement caching must be disabled.- Parameters:
useLayer7Proxy- whether to use a layer 7 proxy instead of a server- Returns:
- a reference to this, so the API can be used fluently
-
setReconnectAttempts
public PgConnectOptions setReconnectAttempts(int attempts)
- Overrides:
setReconnectAttemptsin classSqlConnectOptions
-
setReconnectInterval
public PgConnectOptions setReconnectInterval(long interval)
- Overrides:
setReconnectIntervalin classSqlConnectOptions
-
setTracingPolicy
public PgConnectOptions setTracingPolicy(TracingPolicy tracingPolicy)
- Overrides:
setTracingPolicyin classSqlConnectOptions
-
setSslOptions
public PgConnectOptions setSslOptions(ClientSSLOptions sslOptions)
- Overrides:
setSslOptionsin classSqlConnectOptions
-
init
protected void init()
Initialize with the default options.- Overrides:
initin classSqlConnectOptions
-
toJson
public JsonObject toJson()
- Overrides:
toJsonin classSqlConnectOptions
-
getSocketAddress
public SocketAddress getSocketAddress()
- Overrides:
getSocketAddressin classSqlConnectOptions
-
isUsingDomainSocket
public boolean isUsingDomainSocket()
- Overrides:
isUsingDomainSocketin classSqlConnectOptions
-
merge
public PgConnectOptions merge(JsonObject other)
- Overrides:
mergein classSqlConnectOptions
-
-