public virtual async Task <QueryInfo> GetValueByKeysAsync <TValue>(ViewIdentity view, object[] keys, Action <TValue> onResult, CancellationToken cancellationToken = default) where TValue : class { ThrowIfDisposed(); EnsureArg.IsNotNull(view, nameof(view)); EnsureArg.HasItems(keys, nameof(keys)); EnsureArg.IsNotNull(onResult, nameof(onResult)); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys)); var response = await Client.Views.QueryAsync <TValue>(request, cancellationToken).ForAwait(); ThrowIfNotSuccessfulResponse(response); foreach (var row in response.Rows.Where(r => r.Value != null)) { onResult(row.Value); } return(CreateQueryInfoFrom(response, cancellationToken)); }
public async virtual Task <QueryInfo> GetValueByKeysAsync <TValue>(ViewIdentity view, object[] keys, Action <TValue> onResult) where TValue : class { ThrowIfDisposed(); Ensure.That(view, "view").IsNotNull(); Ensure.That(keys, "keys").HasItems(); Ensure.That(onResult, "onResult").IsNotNull(); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys)); var response = await Client.Views.QueryAsync <TValue>(request).ForAwait(); ThrowIfNotSuccessfulResponse(response); foreach (var row in response.Rows.Where(r => r.Value != null)) { onResult(row.Value); } return(CreateQueryInfoFrom(response)); }
public virtual IObservable <TValue> GetValueByKeys <TValue>(ViewIdentity view, params object[] keys) where TValue : class { ThrowIfDisposed(); Ensure.That(view, "view").IsNotNull(); Ensure.That(keys, "keys").HasItems(); return(Observable.Create <TValue>(async o => { var request = new QueryViewRequest(view).Configure(r => r.Keys(keys)); var response = await Client.Views.QueryAsync <TValue>(request).ForAwait(); ThrowIfNotSuccessfulResponse(response); foreach (var row in response.Rows.Where(r => r.Value != null)) { o.OnNext(row.Value); } o.OnCompleted(); return Disposable.Empty; }).SubscribeOn(ObservableSubscribeOnScheduler())); }
public virtual async Task <IEnumerable <TIncludedDoc> > GetIncludedDocByKeysAsync <TIncludedDoc>(ViewIdentity view, object[] keys, CancellationToken cancellationToken = default) where TIncludedDoc : class { ThrowIfDisposed(); EnsureArg.IsNotNull(view, nameof(view)); EnsureArg.HasItems(keys, nameof(keys)); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys).IncludeDocs(true)); var response = await Client.Views.QueryAsync <string, TIncludedDoc>(request, cancellationToken).ForAwait(); ThrowIfNotSuccessfulResponse(response); return(response.Rows.Where(r => r.IncludedDoc != null).Select(r => r.IncludedDoc)); }
public virtual Task <IEnumerable <string> > GetIncludedDocByKeysAsync(ViewIdentity view, object[] keys, CancellationToken cancellationToken = default) { return(GetIncludedDocByKeysAsync <string>(view, keys, cancellationToken)); }
public virtual Task <QueryInfo> GetIncludedDocByKeysAsync(ViewIdentity view, object[] keys, Action <string> onResult, CancellationToken cancellationToken = default) { ThrowIfDisposed(); return(GetIncludedDocByKeysAsync <string>(view, keys, onResult, cancellationToken)); }
public Query(ViewIdentity viewIdentity) { EnsureArg.IsNotNull(viewIdentity, nameof(viewIdentity)); State = new QueryParameters(viewIdentity); }
public virtual async Task <IEnumerable <TIncludedDoc> > GetIncludedDocByKeysAsync <TIncludedDoc>(ViewIdentity view, params object[] keys) where TIncludedDoc : class { ThrowIfDisposed(); Ensure.That(view, "view").IsNotNull(); Ensure.That(keys, "keys").HasItems(); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys).IncludeDocs(true)); var response = await Client.Views.QueryAsync <string, TIncludedDoc>(request).ForAwait(); ThrowIfNotSuccessfulResponse(response); return(response.Rows.Where(r => r.IncludedDoc != null).Select(r => r.IncludedDoc)); }
public virtual Task <IEnumerable <string> > GetIncludedDocByKeysAsync(ViewIdentity view, params object[] keys) { return(GetIncludedDocByKeysAsync <string>(view, keys)); }
public virtual Task <QueryInfo> GetValueByKeysAsync(ViewIdentity view, object[] keys, Action <string> onResult) { ThrowIfDisposed(); return(GetValueByKeysAsync <string>(view, keys, onResult)); }
public Query(ViewIdentity viewIdentity) { Ensure.That(viewIdentity, "viewIdentity").IsNotNull(); State = new QueryParameters(viewIdentity); }
public virtual async Task <QueryInfo> GetIncludedDocByKeysAsync <TIncludedDoc>(ViewIdentity view, object[] keys, Action <TIncludedDoc> onResult) where TIncludedDoc : class { ThrowIfDisposed(); EnsureArg.IsNotNull(view, nameof(view)); EnsureArg.HasItems(keys, nameof(keys)); EnsureArg.IsNotNull(onResult, nameof(onResult)); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys).IncludeDocs(true)); var response = await Client.Views.QueryAsync <string, TIncludedDoc>(request).ForAwait(); ThrowIfNotSuccessfulResponse(response); foreach (var row in response.Rows.Where(r => r.IncludedDoc != null)) { onResult(row.IncludedDoc); } return(CreateQueryInfoFrom(response)); }
public virtual async Task <IEnumerable <TValue> > GetValueByKeysAsync <TValue>(ViewIdentity view, params object[] keys) where TValue : class { ThrowIfDisposed(); EnsureArg.IsNotNull(view, nameof(view)); EnsureArg.HasItems(keys, nameof(keys)); var request = new QueryViewRequest(view).Configure(r => r.Keys(keys)); var response = await Client.Views.QueryAsync <TValue>(request).ForAwait(); ThrowIfNotSuccessfulResponse(response); return(response.Rows.Where(r => r.Value != null).Select(r => r.Value)); }
public virtual IObservable <string> GetIncludedDocByKeys(ViewIdentity view, params object[] keys) { return(GetIncludedDocByKeys <string>(view, keys)); }