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)); }
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; } }
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;"; }