Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregturn committed Mar 4, 2021
1 parent 9336d09 commit 38311c9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/asciidoc/reference/r2dbc-core.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ You also need a main application to run, as follows:
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcApp.java[tags=class]
include::../{example-root}/R2dbcApp.java[tag=class]
----
====

Expand Down
25 changes: 12 additions & 13 deletions src/main/asciidoc/reference/r2dbc-template.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The following example shows how to insert a row and retrieving its contents:
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=insertAndSelect]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=insertAndSelect]
----
====

Expand All @@ -56,7 +56,7 @@ This functionality is supported by the <<r2dbc.drivers,`R2dbcDialect` abstractio
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=select]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=select]
----
====

Expand All @@ -69,10 +69,9 @@ Consider the following simple query:
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=simpleSelect]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=simpleSelect]
----
<1> Using `Person` with the `from(…)` method sets the `FROM` table based on mapping metadata.
It also maps tabular results on `Person` result objects.
<1> Using `Person` with the `select(…)` method maps tabular results on `Person` result objects.
<2> Fetching `all()` rows returns a `Flux<Person>` without limiting results.
====

Expand All @@ -81,7 +80,7 @@ The following example declares a more complex query that specifies the table nam
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=fullSelect]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=fullSelect]
----
<1> Selecting from a table by name returns row results using the given domain type.
<2> The issued query declares a `WHERE` condition on `firstname` and `lastname` columns to filter results.
Expand Down Expand Up @@ -142,7 +141,7 @@ Consider the following simple typed insert operation:
====
[source,java,indent=0]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=insert]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=insert]
----
<1> Using `Person` with the `into(…)` method sets the `INTO` table, based on mapping metadata.
It also prepares the insert statement to accept `Person` objects for inserting.
Expand All @@ -165,12 +164,12 @@ Consider the following simple typed update operation:
----
Person modified = …
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=update]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=update]
----
<1> Update `Person` objects and apply mapping based on mapping metadata.
<2> Set a different table name by calling the `inTable(…)` method.
<2> Specify a query that translates into a `WHERE` clause.
<3> Apply the `Update` object.
<3> Specify a query that translates into a `WHERE` clause.
<4> Apply the `Update` object.
Set in this case `age` to `42` and return the number of affected rows.
====

Expand All @@ -185,10 +184,10 @@ Consider the following simple insert operation:
====
[source,java]
----
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tags=delete]
include::../{example-root}/R2dbcEntityTemplateSnippets.java[tag=delete]
----
<1> Delete `Person` objects and apply mapping based on mapping metadata.
<2> Set a different table name by calling the `from(…)` method.
<2> Specify a query that translates into a `WHERE` clause.
<3> Apply the delete operation and return the number of affected rows.
<3> Specify a query that translates into a `WHERE` clause.
<4> Apply the delete operation and return the number of affected rows.
====
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public String toString() {
return "Person [id=" + id + ", name=" + name + ", age=" + age + "]";
}
}
// end::class[]}
// end::class[]
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ public static void main(String[] args) {
.verifyComplete();
}
}
// tag::class[]
// end::class[]
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void simpleSelect(R2dbcEntityTemplate template) {

// tag::simpleSelect[]
Flux<Person> people = template.select(Person.class) // <1>
.all();
.all(); // <2>
// end::simpleSelect[]
}

Expand Down

0 comments on commit 38311c9

Please sign in to comment.