Cloud Firestore V1beta1 Client - Class StructuredQuery (1.47.1)

Reference documentation and code samples for the Cloud Firestore V1beta1 Client class StructuredQuery.

A Firestore query.

Generated from protobuf message google.firestore.v1beta1.StructuredQuery

Namespace

Google \ Cloud \ Firestore \ V1beta1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ select StructuredQuery\Projection

The projection to return.

↳ from array<StructuredQuery\CollectionSelector>

The collections to query.

↳ where StructuredQuery\Filter

The filter to apply.

↳ order_by array<StructuredQuery\Order>

The order to apply to the query results. Firestore guarantees a stable ordering through the following rules: * * Any field required to appear in order_by, that is not already specified in order_by, is appended to the order in field name order by default. * * If an order on __name__ is not specified, it is appended by default. Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example: * * SELECT * FROM Foo ORDER BY A becomes SELECT * FROM Foo ORDER BY A, __name__ * * SELECT * FROM Foo ORDER BY A DESC becomes SELECT * FROM Foo ORDER BY A DESC, __name__ DESC * * SELECT * FROM Foo WHERE A > 1 becomes SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__

↳ start_at Cursor

A starting point for the query results.

↳ end_at Cursor

A end point for the query results.

↳ offset int

The number of results to skip. Applies before limit, but after all other constraints. Must be >= 0 if specified.

↳ limit Google\Protobuf\Int32Value

The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified.

getSelect

The projection to return.

Returns
Type Description
StructuredQuery\Projection

setSelect

The projection to return.

Parameter
Name Description
var StructuredQuery\Projection
Returns
Type Description
$this

getFrom

The collections to query.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setFrom

The collections to query.

Parameter
Name Description
var array<StructuredQuery\CollectionSelector>
Returns
Type Description
$this

getWhere

The filter to apply.

Returns
Type Description
StructuredQuery\Filter

setWhere

The filter to apply.

Parameter
Name Description
var StructuredQuery\Filter
Returns
Type Description
$this

getOrderBy

The order to apply to the query results.

Firestore guarantees a stable ordering through the following rules:

  • Any field required to appear in order_by, that is not already specified in order_by, is appended to the order in field name order by default.
  • If an order on __name__ is not specified, it is appended by default. Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example:
  • SELECT * FROM Foo ORDER BY A becomes SELECT * FROM Foo ORDER BY A, __name__
  • SELECT * FROM Foo ORDER BY A DESC becomes SELECT * FROM Foo ORDER BY A DESC, __name__ DESC
  • SELECT * FROM Foo WHERE A > 1 becomes SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__
Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setOrderBy

The order to apply to the query results.

Firestore guarantees a stable ordering through the following rules:

  • Any field required to appear in order_by, that is not already specified in order_by, is appended to the order in field name order by default.
  • If an order on __name__ is not specified, it is appended by default. Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example:
  • SELECT * FROM Foo ORDER BY A becomes SELECT * FROM Foo ORDER BY A, __name__
  • SELECT * FROM Foo ORDER BY A DESC becomes SELECT * FROM Foo ORDER BY A DESC, __name__ DESC
  • SELECT * FROM Foo WHERE A > 1 becomes SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__
Parameter
Name Description
var array<StructuredQuery\Order>
Returns
Type Description
$this

getStartAt

A starting point for the query results.

Returns
Type Description
Cursor

setStartAt

A starting point for the query results.

Parameter
Name Description
var Cursor
Returns
Type Description
$this

getEndAt

A end point for the query results.

Returns
Type Description
Cursor

setEndAt

A end point for the query results.

Parameter
Name Description
var Cursor
Returns
Type Description
$this

getOffset

The number of results to skip.

Applies before limit, but after all other constraints. Must be >= 0 if specified.

Returns
Type Description
int

setOffset

The number of results to skip.

Applies before limit, but after all other constraints. Must be >= 0 if specified.

Parameter
Name Description
var int
Returns
Type Description
$this

getLimit

The maximum number of results to return.

Applies after all other constraints. Must be >= 0 if specified.

Returns
Type Description
Google\Protobuf\Int32Value

getLimitValue

Returns the unboxed value from getLimit()

The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified.

Returns
Type Description
int|null

setLimit

The maximum number of results to return.

Applies after all other constraints. Must be >= 0 if specified.

Parameter
Name Description
var Google\Protobuf\Int32Value
Returns
Type Description
$this

setLimitValue

Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object.

The maximum number of results to return. Applies after all other constraints. Must be >= 0 if specified.

Parameter
Name Description
var int|null
Returns
Type Description
$this