Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GRAPH.DELETE returning boolean #152

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/NRedisStack/Graph/GraphCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ public ResultSet CallProcedure(string graphName, string procedure, IEnumerable<s
}

/// <inheritdoc/>
public ResultSet Delete(string graphName)
public bool Delete(string graphName)
{
var result = _db.Execute(GraphCommandBuilder.Delete(graphName));

var processedResult = new ResultSet(result, _graphCaches[graphName]);

var result = _db.Execute(GraphCommandBuilder.Delete(graphName)).OKtoBoolean();
_graphCaches.Remove(graphName);

return processedResult;
return result;
}

/// <inheritdoc/>
Expand Down
10 changes: 3 additions & 7 deletions src/NRedisStack/Graph/GraphCommandsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,11 @@ public async Task<ResultSet> CallProcedureAsync(string graphName, string procedu


/// <inheritdoc/>
public async Task<ResultSet> DeleteAsync(string graphName)
public async Task<bool> DeleteAsync(string graphName)
{
var result = await _db.ExecuteAsync(GRAPH.DELETE, graphName);

var processedResult = new ResultSet(result, _graphCaches[graphName]);

var result = (await _db.ExecuteAsync(GraphCommandBuilder.Delete(graphName))).OKtoBoolean();
_graphCaches.Remove(graphName);

return processedResult;
return result;
}

/// <inheritdoc/>
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/Graph/IGraphCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public interface IGraphCommands
/// Delete an existing graph.
/// </summary>
/// <param name="graphName">The graph to delete.</param>
/// <returns>A result set.</returns>
/// <returns><see langword="true"/> if executed correctly, error otherwise/></returns>
/// <remarks><seealso href="https://redis.io/commands/graph.delete"/></remarks>
ResultSet Delete(string graphName);
bool Delete(string graphName);

/// <summary>
/// Constructs a query execution plan but does not run it. Inspect this execution plan to better understand how your
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/Graph/IGraphCommandsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public interface IGraphCommandsAsync
/// Delete an existing graph.
/// </summary>
/// <param name="graphName">The graph to delete.</param>
/// <returns>A result set.</returns>
/// <returns><see langword="true"/> if executed correctly, error otherwise/></returns>
/// <remarks><seealso href="https://redis.io/commands/graph.delete"/></remarks>
Task<ResultSet> DeleteAsync(string graphName);
Task<bool> DeleteAsync(string graphName);

/// <summary>
/// Constructs a query execution plan but does not run it. Inspect this execution plan to better understand how your
Expand Down