8000 Add convenience method · MladenMitev/arangodb-java-driver@784bce5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 784bce5

Browse files
author
mpv1989
committed
Add convenience method
`ArangoDatabase#query(String, AqlQueryOptions, Class)`
1 parent b2fb231 commit 784bce5

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1010

1111
- added convenience method `ArangoDatabase#query(String, Class)`
1212
- added convenience method `ArangoDatabase#query(String, Map<String, Object>, Class)`
13+
- added convenience method `ArangoDatabase#query(String, AqlQueryOptions, Class)`
1314

1415
### Fixed
1516

src/main/java/com/arangodb/ArangoDatabase.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,23 @@ public interface ArangoDatabase {
296296
<T> ArangoCursor<T> query(String query, Map<String, Object> bindVars, AqlQueryOptions options, Class<T> type)
297297
throws ArangoDBException;
298298

299+
/**
300+
* Performs a database query using the given {@code query}, then returns a new {@code ArangoCursor} instance for the
301+
* result list.
302+
*
303+
* @see <a href="https://docs.arangodb.com/current/HTTP/AqlQueryCursor/AccessingCursors.html#create-cursor">API
304+
* Documentation</a>
305+
* @param query
306+
* An AQL query string
307+
* @param options
308+
* Additional options that will be passed to the query API, can be null
309+
* @param type
310+
* The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
311+
* @return cursor of the results
312+
* @throws ArangoDBException
313+
*/
314+
<T> ArangoCursor<T> query(String query, AqlQueryOptions options, Class<T> type) throws ArangoDBException;
315+
299316
/**
300317
* Performs a database query using the given {@code query} and {@code bindVars}, then returns a new
301318
* {@code ArangoCursor} instance for the result list.

src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ public <T> ArangoCursor<T> query(final String query, final Map<String, Object> b
198198
return query(query, bindVars, null, type);
199199
}
200200

201+
@Override
202+
public <T> ArangoCursor<T> query(final String query, final AqlQueryOptions options, final Class<T> type)
203+
throws ArangoDBException {
204+
return query(query, null, options, type);
205+
}
206+
201207
@Override
202208
public <T> ArangoCursor<T> query(final String query, final Class<T> type) throws ArangoDBException {
203209
return query(query, null, null, type);

0 commit comments

Comments
 (0)
0