Skip to content

Commit 27749ad

Browse files
committed
Added documentation for options parameter in ConnectionConfiguration
1 parent ca15711 commit 27749ad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ Publisher<? extends Connection> connectionPublisher = connectionFactory.create()
4545
ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
4646
.option(DRIVER, "postgresql")
4747
.option(HOST, "...")
48-
.option(PORT, "...") // optional, defaults to 5432
48+
.option(PORT, 5432) // optional, defaults to 5432
4949
.option(USER, "...")
5050
.option(PASSWORD, "...")
5151
.option(DATABASE, "...") // optional
52+
.option(OPTIONS, Map.of("lock_timeout", "30s", "statement_timeout", "5m")) // optional
5253
.build());
5354

5455
Publisher<? extends Connection> connectionPublisher = connectionFactory.create();
@@ -70,6 +71,7 @@ Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
7071
| `database` | Database to select. _(Optional)_
7172
| `applicationName` | The name of the application connecting to the database. Defaults to `r2dbc-postgresql`. _(Optional)_
7273
| `autodetectExtensions` | Whether to auto-detect and register `Extension`s from the class path. Defaults to `true`. _(Optional)_
74+
| `options` | A `Map<String, String>` of connection parameters. These are applied to each database connection created by the `ConnectionFactory`. Useful for setting generic [PostgreSQL connection parameters][psql-runtime-config]. _(Optional)_
7375
| `schema` | The schema to set. _(Optional)_
7476
| `sslMode` | SSL mode to use, see `SSLMode` enum. Supported values: `DISABLE`, `ALLOW`, `PREFER`, `REQUIRE`, `VERIFY_CA`, `VERIFY_FULL`. _(Optional)_
7577
| `sslRootCert` | Path to SSL CA certificate in PEM format. _(Optional)_
@@ -83,10 +85,11 @@ Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
8385
```java
8486
ConnectionFactory connectionFactory = new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder()
8587
.host("...")
86-
.port("..."). // optional, defaults to 5432
88+
.port(5432) // optional, defaults to 5432
8789
.username("...")
8890
.password("...")
8991
.database("...") // optional
92+
.options(Map.of("lock_timeout", "10s", "search_path", "public, myschema")) // optional
9093
.build());
9194

9295
Mono<Connection> mono = connectionFactory.create();
@@ -318,6 +321,8 @@ Support for the following single-dimensional arrays (read and write):
318321
[psql-txid_snapshot-ref]: https://www.postgresql.org/docs/11/datatype.html
319322
[psql-uuid-ref]: https://www.postgresql.org/docs/11/datatype-uuid.html
320323
[psql-xml-ref]: https://www.postgresql.org/docs/11/datatype-xml.html
324+
[psql-runtime-config]: https://www.postgresql.org/docs/current/runtime-config-client.html
325+
321326

322327

323328
[java-bigdecimal-ref]: https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html

0 commit comments

Comments
 (0)