Class: Google::Apis::DatastoreV1::Query

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/datastore_v1/classes.rb,
lib/google/apis/datastore_v1/representations.rb,
lib/google/apis/datastore_v1/representations.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Query

Returns a new instance of Query.



2407
2408
2409
# File 'lib/google/apis/datastore_v1/classes.rb', line 2407

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#distinct_onArray<Google::Apis::DatastoreV1::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. Corresponds to the JSON property distinctOn



2348
2349
2350
# File 'lib/google/apis/datastore_v1/classes.rb', line 2348

def distinct_on
  @distinct_on
end

#end_cursorString

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. Corresponds to the JSON property endCursor NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


2356
2357
2358
# File 'lib/google/apis/datastore_v1/classes.rb', line 2356

def end_cursor
  @end_cursor
end

#filterGoogle::Apis::DatastoreV1::Filter

A holder for any type of filter. Corresponds to the JSON property filter



2361
2362
2363
# File 'lib/google/apis/datastore_v1/classes.rb', line 2361

def filter
  @filter
end

#find_nearestGoogle::Apis::DatastoreV1::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. Corresponds to the JSON property findNearest



2369
2370
2371
# File 'lib/google/apis/datastore_v1/classes.rb', line 2369

def find_nearest
  @find_nearest
end

#kindArray<Google::Apis::DatastoreV1::KindExpression>

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



2375
2376
2377
# File 'lib/google/apis/datastore_v1/classes.rb', line 2375

def kind
  @kind
end

#limitFixnum

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

Returns:

  • (Fixnum)


2381
2382
2383
# File 'lib/google/apis/datastore_v1/classes.rb', line 2381

def limit
  @limit
end

#offsetFixnum

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

Returns:

  • (Fixnum)


2387
2388
2389
# File 'lib/google/apis/datastore_v1/classes.rb', line 2387

def offset
  @offset
end

#orderArray<Google::Apis::DatastoreV1::PropertyOrder>

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



2392
2393
2394
# File 'lib/google/apis/datastore_v1/classes.rb', line 2392

def order
  @order
end

#projectionArray<Google::Apis::DatastoreV1::Projection>

The projection to return. Defaults to returning all properties. Corresponds to the JSON property projection



2397
2398
2399
# File 'lib/google/apis/datastore_v1/classes.rb', line 2397

def projection
  @projection
end

#start_cursorString

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. Corresponds to the JSON property startCursor NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


2405
2406
2407
# File 'lib/google/apis/datastore_v1/classes.rb', line 2405

def start_cursor
  @start_cursor
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
# File 'lib/google/apis/datastore_v1/classes.rb', line 2412

def update!(**args)
  @distinct_on = args[:distinct_on] if args.key?(:distinct_on)
  @end_cursor = args[:end_cursor] if args.key?(:end_cursor)
  @filter = args[:filter] if args.key?(:filter)
  @find_nearest = args[:find_nearest] if args.key?(:find_nearest)
  @kind = args[:kind] if args.key?(:kind)
  @limit = args[:limit] if args.key?(:limit)
  @offset = args[:offset] if args.key?(:offset)
  @order = args[:order] if args.key?(:order)
  @projection = args[:projection] if args.key?(:projection)
  @start_cursor = args[:start_cursor] if args.key?(:start_cursor)
end