public static final class PostgresqlConnectionConfiguration.Builder extends Object
PostgresqlConnectionConfiguration
instances.
This class is not threadsafe
public PostgresqlConnectionConfiguration.Builder applicationName(String applicationName)
postgresql-r2dbc
.applicationName
- the application namePostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if applicationName
is null
public PostgresqlConnectionConfiguration.Builder autodetectExtensions(boolean autodetectExtensions)
ServiceLoader
to discover and register extensions. Defaults to true.autodetectExtensions
- to discover and register extensionsPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration build()
PostgresqlConnectionConfiguration
.PostgresqlConnectionConfiguration
public PostgresqlConnectionConfiguration.Builder connectTimeout(@Nullable Duration connectTimeout)
connectTimeout
- the connection timeoutPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder codecRegistrar(CodecRegistrar codecRegistrar)
CodecRegistrar
that can contribute extension Codec
s.
Calling this method adds a CodecRegistrar
and does not replace existing Extension
s.codecRegistrar
- registrar to contribute codecsPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder database(@Nullable String database)
database
- the databasePostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder enableSsl()
PostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder extendWith(Extension extension)
Extension
to extend driver functionality.
Calling this method adds a Extension
and does not replace existing Extension
s.extension
- extension to extend driver functionalityPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder fetchSize(int fetchSize)
fetchSize
- the number of rows to fetchBuilder
IllegalArgumentException
- if fetchSize
is negativepublic PostgresqlConnectionConfiguration.Builder fetchSize(ToIntFunction<String> fetchSizeFunction)
fetchSizeFunction
- a function that maps the number of rows to fetchBuilder
IllegalArgumentException
- if fetchSizeFunction
is null
public PostgresqlConnectionConfiguration.Builder forceBinary(boolean forceBinary)
forceBinary
- whether to force binary transferPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder host(String host)
host
- the hostPostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if host
is null
public PostgresqlConnectionConfiguration.Builder options(Map<String,String> options)
These parameters are applied once after creating a new connection. This is useful for setting up client-specific runtime parameters like statement timeouts, time zones etc.
options
- the optionsPostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if options
or any key or value of options
is null
public PostgresqlConnectionConfiguration.Builder password(@Nullable CharSequence password)
password
- the passwordPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder port(int port)
5432
.port
- the portPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder preparedStatementCacheQueries(int preparedStatementCacheQueries)
-1
, meaning there's no limit. The value of 0
disables the cache. Any other value specifies the cache size.preparedStatementCacheQueries
- the preparedStatementCacheQueriesPostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if username
is null
public PostgresqlConnectionConfiguration.Builder schema(@Nullable String schema)
schema
- the schemaPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder socket(String socket)
socket
- the socket pathPostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if socket
is null
public PostgresqlConnectionConfiguration.Builder sslContextBuilderCustomizer(Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContextBuilder> sslContextBuilderCustomizer)
SslContextBuilder
customizer. The customizer gets applied on each SSL connection attempt to allow for just-in-time configuration updates. The Function
gets
called with the prepared SslContextBuilder
that has all configuration options applied. The customizer may return the same builder or return a new builder instance to be used to
build the SSL context.sslContextBuilderCustomizer
- customizer functionPostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if sslContextBuilderCustomizer
is null
public PostgresqlConnectionConfiguration.Builder sslCert(String sslCert)
sslCert
- an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder sslHostnameVerifier(HostnameVerifier sslHostnameVerifier)
sslHostnameVerifier
- HostnameVerifier
PostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder sslKey(String sslKey)
sslKey
- a PKCS#8 private key file in PEM formatPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder sslMode(io.r2dbc.postgresql.client.SSLMode sslMode)
sslMode
- the SSL mode to use.PostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder sslPassword(@Nullable CharSequence sslPassword)
sslPassword
- the password of the sslKey, or null if it's not password-protectedPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder sslRootCert(String sslRootCert)
sslRootCert
- an X.509 certificate chain file in PEM formatPostgresqlConnectionConfiguration.Builder
public PostgresqlConnectionConfiguration.Builder tcpKeepAlive(boolean enabled)
enabled
- whether to enable TCP KeepAlivePostgresqlConnectionConfiguration.Builder
Socket.setKeepAlive(boolean)
public PostgresqlConnectionConfiguration.Builder tcpNoDelay(boolean enabled)
enabled
- whether to enable TCP NoDelayPostgresqlConnectionConfiguration.Builder
Socket.setTcpNoDelay(boolean)
public PostgresqlConnectionConfiguration.Builder username(String username)
username
- the usernamePostgresqlConnectionConfiguration.Builder
IllegalArgumentException
- if username
is null
Copyright © 2020. All rights reserved.