示例#1
0
        public static Task DropPrimaryAsync(this IQueryIndexes queryIndexes, string bucketName, Action <DropPrimaryQueryIndexOptions> configureOptions)
        {
            var options = new DropPrimaryQueryIndexOptions();

            configureOptions(options);

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

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