use of com.google.cloud.firestore.Query.QueryOptions.Builder in project java-firestore by googleapis.
the class Query method startAt.
/**
* Creates and returns a new Query that starts at the provided document (inclusive). The starting
* position is relative to the order of the query. The document must contain all of the fields
* provided in the orderBy of this query.
*
* @param snapshot The snapshot of the document to start at.
* @return The created Query.
*/
@Nonnull
public Query startAt(@Nonnull DocumentSnapshot snapshot) {
ImmutableList<FieldOrder> fieldOrders = createImplicitOrderBy();
Cursor cursor = createCursor(fieldOrders, snapshot, true);
Builder newOptions = options.toBuilder();
newOptions.setFieldOrders(fieldOrders);
newOptions.setStartCursor(cursor);
return new Query(rpcContext, newOptions.build());
}
use of com.google.cloud.firestore.Query.QueryOptions.Builder in project java-firestore by googleapis.
the class Query method startAfter.
/**
* Creates and returns a new Query that starts after the provided document (exclusive). The
* starting position is relative to the order of the query. The document must contain all of the
* fields provided in the orderBy of this query.
*
* @param snapshot The snapshot of the document to start after.
* @return The created Query.
*/
@Nonnull
public Query startAfter(@Nonnull DocumentSnapshot snapshot) {
ImmutableList<FieldOrder> fieldOrders = createImplicitOrderBy();
Cursor cursor = createCursor(fieldOrders, snapshot, false);
Builder newOptions = options.toBuilder();
newOptions.setFieldOrders(fieldOrders);
newOptions.setStartCursor(cursor);
return new Query(rpcContext, newOptions.build());
}
use of com.google.cloud.firestore.Query.QueryOptions.Builder in project java-firestore by googleapis.
the class Query method endBefore.
/**
* Creates and returns a new Query that ends before the provided document (exclusive). The end
* position is relative to the order of the query. The document must contain all of the fields
* provided in the orderBy of this query.
*
* @param snapshot The snapshot of the document to end before.
* @return The created Query.
*/
@Nonnull
public Query endBefore(@Nonnull DocumentSnapshot snapshot) {
ImmutableList<FieldOrder> fieldOrders = createImplicitOrderBy();
Cursor cursor = createCursor(fieldOrders, snapshot, true);
Builder newOptions = options.toBuilder();
newOptions.setFieldOrders(fieldOrders);
newOptions.setEndCursor(cursor);
return new Query(rpcContext, newOptions.build());
}
use of com.google.cloud.firestore.Query.QueryOptions.Builder in project java-firestore by googleapis.
the class Query method endAt.
/**
* Creates and returns a new Query that ends at the provided fields relative to the order of the
* query. The order of the field values must match the order of the order by clauses of the query.
*
* @param fieldValues The field values to end this query at, in order of the query's order by.
* @return The created Query.
*/
@Nonnull
public Query endAt(Object... fieldValues) {
ImmutableList<FieldOrder> fieldOrders = fieldValues.length == 1 && fieldValues[0] instanceof DocumentReference ? createImplicitOrderBy() : options.getFieldOrders();
Cursor cursor = createCursor(fieldOrders, fieldValues, false);
Builder newOptions = options.toBuilder();
newOptions.setFieldOrders(fieldOrders);
newOptions.setEndCursor(cursor);
return new Query(rpcContext, newOptions.build());
}
use of com.google.cloud.firestore.Query.QueryOptions.Builder in project java-firestore by googleapis.
the class Query method endAt.
/**
* Creates and returns a new Query that ends at the provided document (inclusive). The end
* position is relative to the order of the query. The document must contain all of the fields
* provided in the orderBy of this query.
*
* @param snapshot The snapshot of the document to end at.
* @return The created Query.
*/
@Nonnull
public Query endAt(@Nonnull DocumentSnapshot snapshot) {
ImmutableList<FieldOrder> fieldOrders = createImplicitOrderBy();
Cursor cursor = createCursor(fieldOrders, snapshot, false);
Builder newOptions = options.toBuilder();
newOptions.setFieldOrders(fieldOrders);
newOptions.setEndCursor(cursor);
return new Query(rpcContext, newOptions.build());
}
Aggregations