Skip to content

Commit dfb621d

Browse files
authored
Support GRAPH.DELETE returning boolean (#152)
* change graph.Delete returned value to bool * delete comments
1 parent 5f4e766 commit dfb621d

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

src/NRedisStack/Graph/GraphCommands.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,11 @@ public ResultSet CallProcedure(string graphName, string procedure, IEnumerable<s
8585
}
8686

8787
/// <inheritdoc/>
88-
public ResultSet Delete(string graphName)
88+
public bool Delete(string graphName)
8989
{
90-
var result = _db.Execute(GraphCommandBuilder.Delete(graphName));
91-
92-
var processedResult = new ResultSet(result, _graphCaches[graphName]);
93-
90+
var result = _db.Execute(GraphCommandBuilder.Delete(graphName)).OKtoBoolean();
9491
_graphCaches.Remove(graphName);
95-
96-
return processedResult;
92+
return result;
9793
}
9894

9995
/// <inheritdoc/>

src/NRedisStack/Graph/GraphCommandsAsync.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,11 @@ public async Task<ResultSet> CallProcedureAsync(string graphName, string procedu
8787

8888

8989
/// <inheritdoc/>
90-
public async Task<ResultSet> DeleteAsync(string graphName)
90+
public async Task<bool> DeleteAsync(string graphName)
9191
{
92-
var result = await _db.ExecuteAsync(GRAPH.DELETE, graphName);
93-
94-
var processedResult = new ResultSet(result, _graphCaches[graphName]);
95-
92+
var result = (await _db.ExecuteAsync(GraphCommandBuilder.Delete(graphName))).OKtoBoolean();
9693
_graphCaches.Remove(graphName);
97-
98-
return processedResult;
94+
return result;
9995
}
10096

10197
/// <inheritdoc/>

src/NRedisStack/Graph/IGraphCommands.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public interface IGraphCommands
7979
/// Delete an existing graph.
8080
/// </summary>
8181
/// <param name="graphName">The graph to delete.</param>
82-
/// <returns>A result set.</returns>
82+
/// <returns><see langword="true"/> if executed correctly, error otherwise/></returns>
8383
/// <remarks><seealso href="https://redis.io/commands/graph.delete"/></remarks>
84-
ResultSet Delete(string graphName);
84+
bool Delete(string graphName);
8585

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

src/NRedisStack/Graph/IGraphCommandsAsync.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public interface IGraphCommandsAsync
7979
/// Delete an existing graph.
8080
/// </summary>
8181
/// <param name="graphName">The graph to delete.</param>
82-
/// <returns>A result set.</returns>
82+
/// <returns><see langword="true"/> if executed correctly, error otherwise/></returns>
8383
/// <remarks><seealso href="https://redis.io/commands/graph.delete"/></remarks>
84-
Task<ResultSet> DeleteAsync(string graphName);
84+
Task<bool> DeleteAsync(string graphName);
8585

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

0 commit comments

Comments
 (0)