NAME

Google::Datastore::V1::Query - Compiled Protocol Buffers messages for google/datastore/v1/query.proto

SYNOPSIS

use Google::Datastore::V1::Query;

my $msg = Google::Datastore::V1::Query::EntityResult->new({
    entity => $entity,
    version => $version,
    create_time => $create_time,
    update_time => $update_time,
});

# Read or update a field
my $val = $msg->entity();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Datastore::V1::Query::EntityResult->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/datastore/v1/query.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Datastore::V1::Query::EntityResult

The result of fetching an entity from Datastore.

Inherits from Protobuf::Message.

Accessors

  • $msg->entity() / $msg->entity($value)

    Type: Message (Google::Datastore::V1::Entity::Entity)

    The resulting entity.

  • $msg->version() / $msg->version($value)

    Type: Int64

    The version of the entity, a strictly positive number that monotonically increases with changes to the entity.

    This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results.

    For [missing][google.datastore.v1.LookupResponse.missing] entities in `LookupResponse`, this is the version of the snapshot that was used to look up the entity, and it is always set except for eventually consistent reads.

  • $msg->create_time() / $msg->create_time($value)

    Type: Message (Google::Protobuf::Timestamp::Timestamp)

    The time at which the entity was created. This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results. If this entity is missing, this field will not be set.

  • $msg->update_time() / $msg->update_time($value)

    Type: Message (Google::Protobuf::Timestamp::Timestamp)

    The time at which the entity was last changed. This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity results. If this entity is missing, this field will not be set.

  • $msg->cursor() / $msg->cursor($value)

    Type: Bytes

    A cursor that points to the position after the result entity. Set only when the `EntityResult` is part of a `QueryResultBatch` message.

Enum: EntityResult::ResultType

  • RESULT_TYPE_UNSPECIFIED => 0

  • FULL => 1

  • PROJECTION => 2

  • KEY_ONLY => 3

Google::Datastore::V1::Query::Query

A query for entities.

The query stages are executed in the following order: 1. kind 2. filter 3. projection 4. order + start_cursor + end_cursor 5. offset 6. limit 7. find_nearest

Inherits from Protobuf::Message.

Accessors

  • $msg->projection() / $msg->projection($value)

    Type: Message (Google::Datastore::V1::Query::Projection)

    The projection to return. Defaults to returning all properties.

  • $msg->kind() / $msg->kind($value)

    Type: Message (Google::Datastore::V1::Query::KindExpression)

    The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

  • $msg->filter() / $msg->filter($value)

    Type: Message (Google::Datastore::V1::Query::Filter)

    The filter to apply.

  • $msg->order() / $msg->order($value)

    Type: Message (Google::Datastore::V1::Query::PropertyOrder)

    The order to apply to the query results (if empty, order is unspecified).

  • $msg->distinct_on() / $msg->distinct_on($value)

    Type: Message (Google::Datastore::V1::Query::PropertyReference)

    The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

    Requires:

    * If `order` is specified, the set of distinct on properties must appear before the non-distinct on properties in `order`.

  • $msg->start_cursor() / $msg->start_cursor($value)

    Type: Bytes

    A starting point for the query results. Query cursors are returned in query result batches and [can only be used to continue the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).

  • $msg->end_cursor() / $msg->end_cursor($value)

    Type: Bytes

    An ending point for the query results. Query cursors are returned in query result batches and [can only be used to limit the same query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets).

  • $msg->offset() / $msg->offset($value)

    Type: Int32

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

  • $msg->limit() / $msg->limit($value)

    Type: Message (Google::Protobuf::Wrappers::Int32Value)

    The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.

  • $msg->find_nearest() / $msg->find_nearest($value)

    Type: Message (Google::Datastore::V1::Query::FindNearest)

    Optional. A potential Nearest Neighbors Search.

    Applies after all other filters and ordering.

    Finds the closest vector embeddings to the given query vector.

Google::Datastore::V1::Query::AggregationQuery

Datastore query for running an aggregation over a [Query][google.datastore.v1.Query].

Inherits from Protobuf::Message.

Accessors

Google::Datastore::V1::Query::KindExpression

A representation of a kind.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    The name of the kind.

Google::Datastore::V1::Query::PropertyReference

A reference to a property relative to the kind expressions.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    A reference to a property.

    Requires:

    * MUST be a dot-delimited (`.`) string of segments, where each segment conforms to [entity property name][google.datastore.v1.Entity.properties] limitations.

Google::Datastore::V1::Query::Projection

A representation of a property in a projection.

Inherits from Protobuf::Message.

Accessors

Google::Datastore::V1::Query::PropertyOrder

The desired order for a specific property.

Inherits from Protobuf::Message.

Accessors

Enum: PropertyOrder::Direction

  • DIRECTION_UNSPECIFIED => 0

  • ASCENDING => 1

  • DESCENDING => 2

Google::Datastore::V1::Query::Filter

A holder for any type of filter.

Inherits from Protobuf::Message.

Accessors

Google::Datastore::V1::Query::CompositeFilter

A filter that merges multiple other filters using the given operator.

Inherits from Protobuf::Message.

Accessors

Enum: CompositeFilter::Operator

  • OPERATOR_UNSPECIFIED => 0

  • AND => 1

  • OR => 2

Google::Datastore::V1::Query::PropertyFilter

A filter on a specific property.

Inherits from Protobuf::Message.

Accessors

Enum: PropertyFilter::Operator

  • OPERATOR_UNSPECIFIED => 0

  • LESS_THAN => 1

  • LESS_THAN_OR_EQUAL => 2

  • GREATER_THAN => 3

  • GREATER_THAN_OR_EQUAL => 4

  • EQUAL => 5

  • IN => 6

  • NOT_EQUAL => 9

  • HAS_ANCESTOR => 11

  • NOT_IN => 13

Google::Datastore::V1::Query::FindNearest

Nearest Neighbors search config. The ordering provided by FindNearest supersedes the order_by stage. If multiple documents have the same vector distance, the returned document order is not guaranteed to be stable between queries.

Inherits from Protobuf::Message.

Accessors

  • $msg->vector_property() / $msg->vector_property($value)

    Type: Message (Google::Datastore::V1::Query::PropertyReference)

    Required. An indexed vector property to search upon. Only documents which contain vectors whose dimensionality match the query_vector can be returned.

  • $msg->query_vector() / $msg->query_vector($value)

    Type: Message (Google::Datastore::V1::Entity::Value)

    Required. The query vector that we are searching on. Must be a vector of no more than 2048 dimensions.

  • $msg->distance_measure() / $msg->distance_measure($value)

    Type: Enum (Google::Datastore::V1::FindNearest::DistanceMeasure)

    Required. The Distance Measure to use, required.

  • $msg->limit() / $msg->limit($value)

    Type: Message (Google::Protobuf::Wrappers::Int32Value)

    Required. The number of nearest neighbors to return. Must be a positive integer of no more than 100.

  • $msg->distance_result_property() / $msg->distance_result_property($value)

    Type: String

    Optional. Optional name of the field to output the result of the vector distance calculation. Must conform to [entity property][google.datastore.v1.Entity.properties] limitations.

  • $msg->distance_threshold() / $msg->distance_threshold($value)

    Type: Message (Google::Protobuf::Wrappers::DoubleValue)

    Optional. Option to specify a threshold for which no less similar documents will be returned. The behavior of the specified `distance_measure` will affect the meaning of the distance threshold. Since DOT_PRODUCT distances increase when the vectors are more similar, the comparison is inverted.

    * For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold * For DOT_PRODUCT: WHERE distance >= distance_threshold

Enum: FindNearest::DistanceMeasure

  • DISTANCE_MEASURE_UNSPECIFIED => 0

  • EUCLIDEAN => 1

  • COSINE => 2

  • DOT_PRODUCT => 3

Google::Datastore::V1::Query::GqlQuery

A [GQL query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).

Inherits from Protobuf::Message.

Accessors

  • $msg->query_string() / $msg->query_string($value)

    Type: String

    A string of the format described [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference).

  • $msg->allow_literals() / $msg->allow_literals($value)

    Type: Bool

    When false, the query string must not contain any literals and instead must bind all values. For example, `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while `SELECT * FROM Kind WHERE a = @value` is.

  • $msg->named_bindings() / $msg->named_bindings($value)

    Type: Message (Google::Datastore::V1::Query::GqlQuery::NamedBindingsEntry)

    For each non-reserved named binding site in the query string, there must be a named parameter with that name, but not necessarily the inverse.

    Key must match regex `[A-Za-z_$][A-Za-z_$0-9]*`, must not match regex `__.*__`, and must not be `""`.

  • $msg->positional_bindings() / $msg->positional_bindings($value)

    Type: Message (Google::Datastore::V1::Query::GqlQueryParameter)

    Numbered binding site @1 references the first numbered parameter, effectively using 1-based indexing, rather than the usual 0.

    For each binding site numbered i in `query_string`, there must be an i-th numbered parameter. The inverse must also be true.

Google::Datastore::V1::Query::GqlQueryParameter

A binding parameter for a GQL query.

Inherits from Protobuf::Message.

Accessors

  • $msg->value() / $msg->value($value)

    Type: Message (Google::Datastore::V1::Entity::Value)

    A value parameter.

  • $msg->cursor() / $msg->cursor($value)

    Type: Bytes

    A query cursor. Query cursors are returned in query result batches.

Google::Datastore::V1::Query::QueryResultBatch

A batch of results produced by a query.

Inherits from Protobuf::Message.

Accessors

  • $msg->skipped_results() / $msg->skipped_results($value)

    Type: Int32

    The number of results skipped, typically because of an offset.

  • $msg->skipped_cursor() / $msg->skipped_cursor($value)

    Type: Bytes

    A cursor that points to the position after the last skipped result. Will be set when `skipped_results` != 0.

  • $msg->entity_result_type() / $msg->entity_result_type($value)

    Type: Enum (Google::Datastore::V1::EntityResult::ResultType)

    The result type for every entity in `entity_results`.

  • $msg->entity_results() / $msg->entity_results($value)

    Type: Message (Google::Datastore::V1::Query::EntityResult)

    The results for this batch.

  • $msg->end_cursor() / $msg->end_cursor($value)

    Type: Bytes

    A cursor that points to the position after the last result in the batch.

  • $msg->more_results() / $msg->more_results($value)

    Type: Enum (Google::Datastore::V1::QueryResultBatch::MoreResultsType)

    The state of the query after the current batch.

  • $msg->snapshot_version() / $msg->snapshot_version($value)

    Type: Int64

    The version number of the snapshot this batch was returned from. This applies to the range of results from the query's `start_cursor` (or the beginning of the query if no cursor was given) to this batch's `end_cursor` (not the query's `end_cursor`).

    In a single transaction, subsequent query result batches for the same query can have a greater snapshot version number. Each batch's snapshot version is valid for all preceding batches. The value will be zero for eventually consistent queries.

  • $msg->read_time() / $msg->read_time($value)

    Type: Message (Google::Protobuf::Timestamp::Timestamp)

    Read timestamp this batch was returned from. This applies to the range of results from the query's `start_cursor` (or the beginning of the query if no cursor was given) to this batch's `end_cursor` (not the query's `end_cursor`).

    In a single transaction, subsequent query result batches for the same query can have a greater timestamp. Each batch's read timestamp is valid for all preceding batches. This value will not be set for eventually consistent queries in Cloud Datastore.

Enum: QueryResultBatch::MoreResultsType

  • MORE_RESULTS_TYPE_UNSPECIFIED => 0

  • NOT_FINISHED => 1

  • MORE_RESULTS_AFTER_LIMIT => 2

  • MORE_RESULTS_AFTER_CURSOR => 4

  • NO_MORE_RESULTS => 3

SEE ALSO

Protobuf, Protobuf::Message, Google::Datastore::V1::Query::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.