예제 #1
0
        public static Task DropAsync(this IQueryIndexes queryIndexes, string bucketName, string indexName, Action <DropQueryIndexOptions> configureOptions)
        {
            var options = new DropQueryIndexOptions();

            configureOptions(options);

            return(queryIndexes.DropAsync(bucketName, indexName, options));
        }
        public async Task DropAsync(string bucketName, string indexName, DropQueryIndexOptions options)
        {
            Logger.LogInformation($"Attempting to drop query index {indexName} on bucket {bucketName}");

            try
            {
                var statement = $"DROP INDEX {bucketName}.{indexName} USING GSI;";
                await _queryClient.QueryAsync <dynamic>(statement,
                                                        queryOptions => queryOptions.WithCancellationToken(options.CancellationToken)
                                                        );
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Error trying to drop query index {indexName} on {bucketName}");
                throw;
            }
        }