public async Task <QueryResult> ScanAsync(ScanRequest request) { var httpRequest = Setup("Scan", request.ToJson()); var json = await SendAndReadJsonElementAsync(httpRequest).ConfigureAwait(false); return(QueryResult.FromJsonElement(json)); }
public async Task <QueryResult> ScanAsync(ScanRequest request) { var httpRequest = Setup("Scan", request.ToJson()); var responseText = await SendAsync(httpRequest).ConfigureAwait(false); var responseJson = JsonObject.Parse(responseText); return(QueryResult.FromJson(responseJson)); }
public IEnumerable <T> Enumerate(params Expression[] conditions) // Scans the entire table { // Each scan may return upto 1MB of data // TODO, consider parellel scans DynamoExpression filterExpression = null; if (conditions.Length > 0) { filterExpression = DynamoExpression.Conjunction(conditions); } var result = new QueryResult(); do { var request = new ScanRequest(tableName) { Limit = 1000, ExclusiveStartKey = result.LastEvaluatedKey }; if (filterExpression != null) { request.SetFilterExpression(filterExpression); } result = client.Scan(request).Result; // If LastEvaluatedKey is null, then the "last page" of results has been processed and there is no more data to be retrieved. // If LastEvaluatedKey is anything other than null, this does not necessarily mean that there is more data in the result set. // The only way to know when you have reached the end of the result set is when LastEvaluatedKey is null. foreach (var item in result.Items) { yield return(item.As <T>(metadata)); } }while (result.LastEvaluatedKey != null); }
public async Task <IList <T> > ScanAsync(IEnumerable <KeyValuePair <string, object> > startKey = null, Expression[] conditions = null, int take = 1000) { var request = new ScanRequest(tableName) { Limit = take }; if (conditions != null && conditions.Length > 0) { request.SetFilterExpression(DynamoExpression.Conjunction(conditions)); } if (startKey != null) { request.ExclusiveStartKey = AttributeCollection.FromJson(startKey.ToJson()); } var result = await client.Scan(request).ConfigureAwait(false); return(new QueryResult <T>(result)); }