public async Task <IEnumerable <QueryIndex> > GetAllAsync(string bucketName, GetAllQueryIndexOptions options) { Logger.LogInformation($"Attempting to get query indexes for bucket {bucketName}"); try { var statement = $"SELECT i.* FROM system:indexes AS i WHERE i.keyspace_id=\"{bucketName}\" AND `using`=\"gsi\";"; var result = await _queryClient.QueryAsync <QueryIndex>(statement, queryOptions => queryOptions.WithCancellationToken(options.CancellationToken) ); var indexes = new List <QueryIndex>(); foreach (var row in result) { indexes.Add(row); } return(indexes); } catch (Exception exception) { Logger.LogError(exception, $"Error trying to get query indexes for bucket {bucketName}"); throw; } }
public static Task <IEnumerable <QueryIndex> > GetAllAsync(this IQueryIndexes queryIndexes, string bucketName, Action <GetAllQueryIndexOptions> configureOptions) { var options = new GetAllQueryIndexOptions(); configureOptions(options); return(queryIndexes.GetAllAsync(bucketName, options)); }