コード例 #1
0
        public static Task DropIndexAsync(this IQueryIndexManager queryIndexManager, string bucketName, string indexName, Action <DropQueryIndexOptions> configureOptions)
        {
            var options = new DropQueryIndexOptions();

            configureOptions(options);

            return(queryIndexManager.DropIndexAsync(bucketName, indexName, options));
        }
コード例 #2
0
        public async Task DropIndexAsync(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;
            }
        }
コード例 #3
0
 public static string CreateDropIndexStatement(string bucketName, string indexName, DropQueryIndexOptions options)
 {
     if (options.ScopeNameValue == null)
     {
         return $"DROP INDEX {bucketName.EscapeIfRequired()}.{indexName.EscapeIfRequired()} USING GSI;";
     }
     return $"DROP INDEX {indexName.EscapeIfRequired()} ON {bucketName.EscapeIfRequired()}.{options.ScopeNameValue.EscapeIfRequired()}.{options.CollectionNameValue.EscapeIfRequired()} USING GSI;";
 }