/// <inheritdoc/> public override LazyDatastoreQuery RunQueryLazily( GqlQuery gqlQuery, ReadConsistency?readConsistency = null, CallSettings callSettings = null) { GaxPreconditions.CheckNotNull(gqlQuery, nameof(gqlQuery)); var request = new RunQueryRequest { ProjectId = ProjectId, PartitionId = _partitionId, GqlQuery = gqlQuery, ReadOptions = GetReadOptions(readConsistency) }; var streamer = new QueryStreamer(request, Client.RunQueryApiCall, callSettings); return(new LazyDatastoreQuery(streamer.Sync())); }
/// <inheritdoc/> public override DatastoreAsyncQueryResults RunQueryAsync( Query query, ReadConsistency?readConsistency = null, CallSettings callSettings = null) { GaxPreconditions.CheckNotNull(query, nameof(query)); var request = new RunQueryRequest { ProjectId = ProjectId, PartitionId = _partitionId, Query = query, ReadOptions = GetReadOptions(readConsistency) }; var streamer = new QueryStreamer(request, Client.RunQueryApiCall, callSettings); return(new DatastoreAsyncQueryResults(streamer.Async())); }
private static ReadOptions GetReadOptions(ReadConsistency?readConsistency) => readConsistency == null ? null : new ReadOptions { ReadConsistency = readConsistency.Value };
/// <inheritdoc/> public override Task <IReadOnlyList <Entity> > LookupAsync(IEnumerable <Key> keys, ReadConsistency?readConsistency = null, CallSettings callSettings = null) => LookupImplAsync(Client, ProjectId, GetReadOptions(readConsistency), keys, callSettings);
/// <summary> /// Looks up a collection of entities by key asynchronously. /// </summary> /// <remarks> /// This call may perform multiple RPC operations in order to look up all keys. /// </remarks> /// <param name="keys">The keys to look up. Must not be null, and every element must be non-null and refer to a complete key.</param> /// <param name="readConsistency">The desired read consistency of the lookup, or null to use the default.</param> /// <param name="callSettings">If not null, applies overrides to RPC calls.</param> /// <returns>A collection of entities with the same size as <paramref name="keys"/>, containing corresponding entity /// references, or <c>null</c> where the key was not found.</returns> public virtual Task <IReadOnlyList <Entity> > LookupAsync(IEnumerable <Key> keys, ReadConsistency?readConsistency = null, CallSettings callSettings = null) { throw new NotImplementedException(); }
/// <summary> /// Looks up a single entity by key asynchronously. /// </summary> /// <remarks>This method simply delegates to <see cref="LookupAsync(IEnumerable{Key}, ReadConsistency?, CallSettings)"/>.</remarks> /// <param name="key">The key to look up. Must not be null, and must be complete.</param> /// <param name="readConsistency">The desired read consistency of the lookup, or null to use the default.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The entity with the specified key, or <c>null</c> if no such entity exists.</returns> public virtual async Task <Entity> LookupAsync(Key key, ReadConsistency?readConsistency = null, CallSettings callSettings = null) { var results = await LookupAsync(new[] { key }, readConsistency, callSettings).ConfigureAwait(false); return(results[0]); }
/// <summary> /// Looks up a single entity by key. /// </summary> /// <remarks>This method simply delegates to <see cref="Lookup(IEnumerable{Key}, ReadConsistency?, CallSettings)"/>.</remarks> /// <param name="key">The key to look up. Must not be null, and must be complete.</param> /// <param name="readConsistency">The desired read consistency of the lookup, or null to use the default.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The entity with the specified key, or <c>null</c> if no such entity exists.</returns> public virtual Entity Lookup(Key key, ReadConsistency?readConsistency = null, CallSettings callSettings = null) => Lookup(new[] { key }, readConsistency, callSettings)[0];
/// <summary> /// Executes the given GQL query, returning a result set that can be viewed as an asynchronous /// sequence of entities, entity results (with cursors), batches, or raw API responses. /// </summary> /// <remarks> /// The results are requested lazily: no API calls will be made until the application starts /// iterating over the results. Iterating over the same <see cref="DatastoreQueryResults"/> object /// multiple times will execute the query again, potentially returning different results. /// </remarks> /// <param name="query">The query to execute. Must not be null.</param> /// <param name="readConsistency">If not null, overrides the read consistency of the query.</param> /// <param name="callSettings">If not null, applies overrides to RPC calls.</param> /// <returns>A <see cref="DatastoreQueryResults"/> representing the result of the query.</returns> public virtual DatastoreAsyncQueryResults RunQueryAsync( GqlQuery gqlQuery, ReadConsistency?readConsistency = null, CallSettings callSettings = null) { throw new NotImplementedException(); }