Skip to content

Commit 8461545

Browse files
schaudermp911de
authored andcommitted
#25 - Polishing.
Fix typos. Improve wording. Replace document with row and collection with table. Original pull request: #28.
1 parent a6140b8 commit 8461545

File tree

6 files changed

+57
-35
lines changed

6 files changed

+57
-35
lines changed

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<r2dbc-postgresql.version>1.0.0.M6</r2dbc-postgresql.version>
3636
<r2dbc-h2.version>1.0.0.M6</r2dbc-h2.version>
3737
<r2dbc-mssql.version>1.0.0.M6</r2dbc-mssql.version>
38+
<reactive-streams.version>1.0.1</reactive-streams.version>
3839
<testcontainers.version>1.10.1</testcontainers.version>
3940

4041
</properties>
@@ -343,6 +344,25 @@
343344
<plugin>
344345
<groupId>org.asciidoctor</groupId>
345346
<artifactId>asciidoctor-maven-plugin</artifactId>
347+
<configuration>
348+
<sourceDirectory>${project.root}/src/main/asciidoc</sourceDirectory>
349+
<sourceDocumentName>index.adoc</sourceDocumentName>
350+
<doctype>book</doctype>
351+
<attributes>
352+
<version>${project.version}</version>
353+
<projectName>${project.name}</projectName>
354+
<projectVersion>${project.version}</projectVersion>
355+
<aspectjVersion>${aspectj}</aspectjVersion>
356+
<querydslVersion>${querydsl}</querydslVersion>
357+
<springVersion>${spring}</springVersion>
358+
<r2dbcVersion>${r2dbc-spi.version}</r2dbcVersion>
359+
<reactiveStreamsVersion>${reactive-streams.version}</reactiveStreamsVersion>
360+
<releasetrainVersion>${releasetrain}</releasetrainVersion>
361+
<allow-uri-read>true</allow-uri-read>
362+
<toclevels>3</toclevels>
363+
<numbered>true</numbered>
364+
</attributes>
365+
</configuration>
346366
</plugin>
347367
</plugins>
348368
</build>

src/main/asciidoc/index.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
:imagesdir: images
1313
ifdef::backend-epub3[:front-cover-image: image:epub-cover.png[Front Cover,1050,1600]]
1414
:spring-data-commons-docs: ../../../../spring-data-commons/src/main/asciidoc
15-
:rr2dbcVersion: 1.0.0.M6
16-
:reactiveStreamsVersion: 1.0.1
1715
:reactiveStreamsJavadoc: http://www.reactive-streams.org/reactive-streams-{reactiveStreamsVersion}-javadoc
1816

1917
(C) 2018 The original authors.

src/main/asciidoc/preface.adoc

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ While the open source ecosystem hosts various non-blocking relational database d
5050
The term, reactive refers to programming models that are built around reacting to change, availability, and processability — network components reacting to I/O events, UI controllers reacting to mouse events, resources being made available and others.
5151
In that sense, non-blocking is reactive, because, instead of being blocked, we are now in the mode of reacting to notifications as operations complete or data becomes available.
5252

53-
There is also another important mechanism that we on the Spring team associate with reactive and that is non-blocking back pressure.
53+
There is also another important mechanism that we on the Spring team associated with reactive and that is non-blocking back pressure.
5454
In synchronous, imperative code, blocking calls serve as a natural form of back pressure that forces the caller to wait.
55-
In non-blocking code, it becomes important to control the rate of events so that a fast producer does not overwhelm its destination.
55+
In non-blocking code, it becomes essential to control the rate of events so that a fast producer does not overwhelm its destination.
5656

57-
Reactive Streams is a https://github.com/reactive-streams/reactive-streams-jvm/blob/v{reactiveStreamsVersion}/README.md#specification[small spec] (also https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html[adopted] in Java 9) that defines the interaction between asynchronous components with back pressure.
58-
For example a data repository (acting as {reactiveStreamsJavadoc}/org/reactivestreams/Publisher.html[`Publisher`]) can produce data that an HTTP server (acting as {reactiveStreamsJavadoc}/org/reactivestreams/Subscriber.html`[`Subscriber`]) can then write to the response.
59-
The main purpose of Reactive Streams is to let the subscriber to control how quickly or how slowly the publisher produces data.
57+
https://github.com/reactive-streams/reactive-streams-jvm/blob/v{reactiveStreamsVersion}/README.md#specification[Reactive Streams is a small spec] (also https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html[adopted in Java 9]) that defines the interaction between asynchronous components with back pressure.
58+
For example, a data repository (acting as {reactiveStreamsJavadoc}/org/reactivestreams/Publisher.html[`Publisher`]) can produce data that an HTTP server (acting as {reactiveStreamsJavadoc}/org/reactivestreams/Subscriber.html`[`Subscriber`]) can then write to the response.
59+
The main purpose of Reactive Streams is to let the subscriber control how quickly or how slowly the publisher produces data.
6060

6161
[[get-started:first-steps:reactive-api]]
6262
== Reactive API
@@ -81,8 +81,8 @@ Whenever feasible, Spring Data adapts transparently to the use of RxJava or anot
8181
The Spring Data R2DBC 1.x binaries require:
8282

8383
* JDK level 8.0 and above
84-
* http://spring.io/docs[Spring Framework] {springVersion} and above
85-
* R2DBC {r2dbcVersion} and above
84+
* https://spring.io/docs[Spring Framework] {springVersion} and above
85+
* https://r2dbc.io[R2DBC] {r2dbcVersion} and above
8686

8787
[[get-started:help]]
8888
== Additional Help Resources
@@ -101,12 +101,15 @@ Professional Support :: Professional, from-the-source support, with guaranteed r
101101
[[get-started:up-to-date]]
102102
== Following Development
103103

104-
For information on the Spring Data R2DBC source code repository, nightly builds, and snapshot artifacts, see the Spring Data R2DBC http://projects.spring.io/spring-data-r2dbc/[homepage].
105-
You can help make Spring Data best serve the needs of the Spring community by interacting with developers through the Community on http://stackoverflow.com/questions/tagged/spring-data[Stack Overflow].
106-
To follow developer activity, look for the mailing list information on the Spring Data R2DBC https://projects.spring.io/spring-data-r2dbc/[homepage].
107-
If you encounter a bug or want to suggest an improvement, please create a ticket on the Spring Data R2DBC https://github.com/spring-projects/spring-data-r2dbc/issues[issue tracker].
108-
To stay up to date with the latest news and announcements in the Spring eco system, subscribe to the Spring Community http://spring.io[Portal].
109-
You can also follow the Spring http://spring.io/blog[blog] or the Spring Data project team on Twitter (http://twitter.com/SpringData[SpringData]).
104+
* For information on the Spring Data R2DBC source code repository, nightly builds, and snapshot artifacts, see the Spring Data R2DBC http://projects.spring.io/spring-data-r2dbc/[homepage].
105+
106+
* You can help make Spring Data best serve the needs of the Spring community by interacting with developers through the Community on http://stackoverflow.com/questions/tagged/spring-data[Stack Overflow].
107+
108+
* If you encounter a bug or want to suggest an improvement, please create a ticket on the Spring Data R2DBC https://github.com/spring-projects/spring-data-r2dbc/issues[issue tracker].
109+
110+
* To stay up to date with the latest news and announcements in the Spring ecosystem, subscribe to the Spring Community http://spring.io[Portal].
111+
112+
* You can also follow the Spring http://spring.io/blog[blog] or the Spring Data project team on Twitter (http://twitter.com/SpringData[SpringData]).
110113

111114
== Project Metadata
112115

src/main/asciidoc/reference/mapping.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The `MappingR2dbcConverter` can use metadata to drive the mapping of objects to
7272
* `@PersistenceConstructor`: Marks a given constructor - even a package protected one - to use when instantiating the object from the database. Constructor arguments are mapped by name to the key values in the retrieved row.
7373
* `@Column`: Applied at the field level and described the name of the column as it will be represented in the row thus allowing the name to be different than the fieldname of the class.
7474

75-
The mapping metadata infrastructure is defined in a separate spring-data-commons project that is technology agnostic. Specific subclasses are using in the R2DBC support to support annotation based metadata. Other strategies are also possible to put in place if there is demand.
75+
The mapping metadata infrastructure is defined in the separate spring-data-commons project that is technology agnostic. Specific subclasses are using in the R2DBC support to support annotation based metadata. Other strategies are also possible to put in place if there is demand.
7676

7777

7878
[[mapping-custom-object-construction]]
@@ -81,7 +81,7 @@ The mapping metadata infrastructure is defined in a separate spring-data-commons
8181
The mapping subsystem allows the customization of the object construction by annotating a constructor with the `@PersistenceConstructor` annotation. The values to be used for the constructor parameters are resolved in the following way:
8282

8383
* If a parameter is annotated with the `@Value` annotation, the given expression is evaluated and the result is used as the parameter value.
84-
* If the Java type has a property whose name matches the given field of the input row, then it's property information is used to select the appropriate constructor parameter to pass the input field value to. This works only if the parameter name information is present in the java `.class` files which can be achieved by compiling the source with debug information or using the new `-parameters` command-line switch for javac in Java 8.
84+
* If the Java type has a property whose name matches the given field of the input row, then it's property information is used to select the appropriate constructor parameter to pass the input field value to. This works only if the parameter name information is present in the java `.class` files which can be achieved by compiling the source with debug information or using the `-parameters` command-line switch for javac in Java 8.
8585
* Otherwise a `MappingException` will be thrown indicating that the given constructor parameter could not be bound.
8686

8787
[source,java]

src/main/asciidoc/reference/r2dbc-repositories.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class PersonRepositoryTests {
7777
@Autowired PersonRepository repository;
7878
7979
@Test
80-
public void readsallEntitiesCorrectly() {
80+
public void readsAllEntitiesCorrectly() {
8181
8282
repository.findAll()
8383
.as(StepVerifier::create)
@@ -119,3 +119,5 @@ The annotated query uses native bind markers, which are Postgres bind markers in
119119
====
120120

121121
NOTE: R2DBC repositories do not support query derivation.
122+
123+
NOTE: R2DBC repositories require native parameter bind markers that are bound by index.

src/main/asciidoc/reference/r2dbc.adoc

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For most tasks, you should use `DatabaseClient` or the Repository support, which
1818

1919
An easy way to bootstrap setting up a working environment is to create a Spring-based project through https://start.spring.io[start.spring.io].
2020

21-
.Add the following to the pom.xml files `dependencies` element:
21+
. Add the following to the pom.xml files `dependencies` element:
2222
+
2323
[source,xml,subs="+attributes"]
2424
----
@@ -35,7 +35,7 @@ An easy way to bootstrap setting up a working environment is to create a Spring-
3535
<!-- a R2DBC driver -->
3636
<dependency>
3737
<groupId>io.r2dbc</groupId>
38-
<artifactId></artifactId>
38+
<artifactId>r2dbc-h2</artifactId>
3939
<version>{r2dbcVersion}</version>
4040
</dependency>
4141
@@ -127,16 +127,16 @@ public class R2dbcApp {
127127
public static void main(String[] args) throws Exception {
128128
129129
ConnectionFactory connectionFactory = new H2ConnectionFactory(H2ConnectionConfiguration.builder()
130-
.url("mem:test;DB_CLOSE_DELAY=10")
131-
.build());
130+
.url("mem:test;DB_CLOSE_DELAY=10")
131+
.build());
132132
133133
DatabaseClient client = DatabaseClient.create(connectionFactory);
134134
135135
client.execute()
136136
.sql("CREATE TABLE person" +
137-
" (id VARCHAR(255) PRIMARY KEY," +
138-
" name VARCHAR(255)," +
139-
" age INT)")
137+
"(id VARCHAR(255) PRIMARY KEY," +
138+
"name VARCHAR(255)," +
139+
"age INT)")
140140
.fetch()
141141
.rowsUpdated()
142142
.as(StepVerifier::create)
@@ -162,7 +162,7 @@ public class R2dbcApp {
162162
}
163163
----
164164

165-
When you run the main program, the preceding examples produce the following output:
165+
When you run the main program, the preceding examples produce output similar to the following:
166166

167167
[source]
168168
----
@@ -364,7 +364,7 @@ NOTE: `execute().sql(…)` accepts either the SQL query string or a query `Suppl
364364
=== Running Queries
365365

366366
SQL queries can return values or the number of affected rows.
367-
`DatabaseClient` can return the number of updated rows or the rows themself, depending on the issued query.
367+
`DatabaseClient` can return the number of updated rows or the rows themselves, depending on the issued query.
368368

369369
The following example shows an `UPDATE` statement that returns the number of updated rows:
370370

@@ -409,7 +409,7 @@ Flux<Person> all = client.execute()
409409
[[r2dbc.datbaseclient.mapping]]
410410
=== Mapping Results
411411

412-
You can customize result extraction beyong `Map` and POJO result extraction by providing an extractor `BiFunction<Row, RowMetadata, T>`.
412+
You can customize result extraction beyond `Map` and POJO result extraction by providing an extractor `BiFunction<Row, RowMetadata, T>`.
413413
The extractor function interacts directly with R2DBC's `Row` and `RowMetadata` objects and can return arbitrary values (singular values, collections/maps, objects).
414414

415415
The following example extracts the `id` column and emits its value:
@@ -418,8 +418,7 @@ The following example extracts the `id` column and emits its value:
418418
----
419419
Flux<String> names= client.execute()
420420
.sql("SELECT name FROM person")
421-
.fetch()
422-
.extract((row, rowMetadata) -> row.get("id", String.class))
421+
.map((row, rowMetadata) -> row.get("id", String.class))
423422
.all();
424423
----
425424

@@ -435,11 +434,11 @@ You must wrap any `null` values in an object (e.g. `Optional` for singular value
435434
[[r2dbc.datbaseclient.binding]]
436435
=== Binding Values to Queries
437436

438-
A typical application requires parametrized SQL statements to select or update rows according to some input.
437+
A typical application requires parameterized SQL statements to select or update rows according to some input.
439438
These are typically `SELECT` statements constrained by a `WHERE` clause or `INSERT`/`UPDATE` statements accepting input parameters.
440-
Parametrized statements bear the risk of SQL injection if parameters are not escaped properly.
439+
Parameterized statements bear the risk of SQL injection if parameters are not escaped properly.
441440
`DatabaseClient` leverages R2DBC's Bind API to eliminate the risk of SQL injection for query parameters.
442-
You can provide a parametrized SQL statement with the `sql(…)` operator and bind parameters to the actual `Statement`.
441+
You can provide a parameterized SQL statement with the `sql(…)` operator and bind parameters to the actual `Statement`.
443442
Your R2DBC driver then executes the statement using prepared statements and parameter substitution.
444443

445444
Parameter binding supports various binding strategies:
@@ -458,8 +457,8 @@ db.execute()
458457
.bind(2, 34);
459458
----
460459

461-
NOTE: If you are familiar with JDBC, then you're also familiar with `?` (questionmark) bind markers.
462-
JDBC drivers translate questionmark bindmarkers to database-native markers as part of statement execution.
460+
NOTE: If you are familiar with JDBC, then you're also familiar with `?` (question mark) bind markers.
461+
JDBC drivers translate question mark bind markers to database-native markers as part of statement execution.
463462
Make sure to use the appropriate bind markers that are supported by your database as R2DBC requires database-native parameter bind markers.
464463

465464
[[r2dbc.datbaseclient.transactions]]

0 commit comments

Comments
 (0)