-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjusted documentation of dbList command (Java) #1289
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ related_commands: | |
# Command syntax # | ||
|
||
{% apibody %} | ||
r.dbList() → array | ||
r.dbList() → DbList | ||
{% endapibody %} | ||
|
||
# Description # | ||
|
@@ -22,5 +22,9 @@ List all database names in the cluster. The result is a list of strings. | |
__Example:__ List all databases. | ||
|
||
```java | ||
r.dbList().run(conn); | ||
List<?> dbList = r.dbList().run(connection, ArrayList.class).single(); | ||
|
||
if (dbList != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar with the Java driver, but I think dbList will never be null. Unless RethinkDB returns a nil result. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this example, my IDE (IntelliJ IDEA) complained that In the end I did something more like this: final Result<?> result = r.dbList().run(connection, List.class);
try (result) {
List<?> databaseList = (List<?>) result.single();
if (databaseList != null) {
databaseList.forEach(System.out::println);
}
} So, maybe that should be the example code? People can still leave out anything they do not want or rewrite it according to their needs. My thought was just to provide a hint on how to use it. And maybe a more elaborated example could also lower the hurdle for new developers, to see how they could use it. But of course the provided example should show a somewhat recommended way. For me |
||
dbList.forEach(System.out::println); | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type should be
array
. The types in this section refer to ReQL types, not Java types.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will revert that.