Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shacharPash committed Sep 11, 2023
1 parent 9c56265 commit a488f2a
Show file tree
Hide file tree
Showing 25 changed files with 96 additions and 78 deletions.
11 changes: 8 additions & 3 deletions src/NRedisStack/Graph/GraphCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@ internal sealed class GraphCache
public GraphCacheList PropertyNames { get; set; }
public GraphCacheList RelationshipTypes { get; set; }

[Obsolete]
public GraphCache(string graphName, GraphCommands redisGraph)
{
Labels = new GraphCacheList(graphName, "db.labels", redisGraph);
PropertyNames = new GraphCacheList(graphName, "db.propertyKeys", redisGraph);
RelationshipTypes = new GraphCacheList(graphName, "db.relationshipTypes", redisGraph);
}

[Obsolete]
public GraphCache(string graphName, GraphCommandsAsync redisGraph)
{
Labels = new GraphCacheList(graphName, "db.labels", redisGraph);
PropertyNames = new GraphCacheList(graphName, "db.propertyKeys", redisGraph);
RelationshipTypes = new GraphCacheList(graphName, "db.relationshipTypes", redisGraph);
}

public string GetLabel(int index) => Labels.GetCachedData(index);
[Obsolete]
public string GetLabel(int index) => Labels.GetCachedData(index)!;

public string GetRelationshipType(int index) => RelationshipTypes.GetCachedData(index);
[Obsolete]
public string GetRelationshipType(int index) => RelationshipTypes.GetCachedData(index)!;

public string GetPropertyName(int index) => PropertyNames.GetCachedData(index);
[Obsolete]
public string GetPropertyName(int index) => PropertyNames.GetCachedData(index)!;

}
}
9 changes: 7 additions & 2 deletions src/NRedisStack/Graph/GraphCacheList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal sealed class GraphCacheList
private readonly string _procedure;

private string[] _data = Array.Empty<string>();

[Obsolete]
private readonly GraphCommandsAsync _redisGraph;

private readonly object _locker = new object();
Expand All @@ -17,6 +17,7 @@ internal sealed class GraphCacheList
/// <param name="graphName">The name of the graph to cache information for.</param>
/// <param name="procedure">The saved procedure to call to populate cache. Must be a `read` procedure.</param>
/// <param name="redisGraph">The graph used for the calling the <paramref name="procedure"/>.</param>
[Obsolete]
internal GraphCacheList(string graphName, string procedure, GraphCommands redisGraph)
{
_graphName = graphName;
Expand All @@ -31,6 +32,7 @@ internal GraphCacheList(string graphName, string procedure, GraphCommands redisG
/// <param name="graphName">The name of the graph to cache information for.</param>
/// <param name="procedure">The saved procedure to call to populate cache. Must be a `read` procedure.</param>
/// <param name="redisGraph">The graph used for the calling the <paramref name="procedure"/>.</param>
[Obsolete]
internal GraphCacheList(string graphName, string procedure, GraphCommandsAsync redisGraphAsync)
{
_graphName = graphName;
Expand All @@ -40,7 +42,8 @@ internal GraphCacheList(string graphName, string procedure, GraphCommandsAsync r
}

// TODO: Change this to use Lazy<T>?
internal string GetCachedData(int index)
[Obsolete]
internal string? GetCachedData(int index)
{
if (index >= _data.Length)
{
Expand All @@ -56,6 +59,7 @@ internal string GetCachedData(int index)
return _data.ElementAtOrDefault(index);
}

[Obsolete]
private string[] GetProcedureInfo()
{
var resultSet = CallProcedure();
Expand All @@ -64,6 +68,7 @@ private string[] GetProcedureInfo()
.ToArray();
}

[Obsolete]
private ResultSet CallProcedure()
{
return _redisGraph is GraphCommands graphSync
Expand Down
1 change: 1 addition & 0 deletions src/NRedisStack/Graph/GraphCommandsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace NRedisStack
{
[Obsolete]
public class GraphCommandsAsync : IGraphCommandsAsync
{
readonly IDatabaseAsync _db;
Expand Down
12 changes: 7 additions & 5 deletions src/NRedisStack/Graph/Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ public enum ResultSetColumnTypes
/// <value></value>
public List<string> SchemaNames { get; }

[Obsolete]
internal Header(RedisResult result)
{
SchemaTypes = new List<ResultSetColumnTypes>();
SchemaNames = new List<string>();

foreach (RedisResult[] tuple in (RedisResult[])result)
foreach (RedisResult[]? tuple in (RedisResult[])result!)
{
SchemaTypes.Add((ResultSetColumnTypes)(int)tuple[0]);
SchemaNames.Add((string)tuple[1]);
SchemaTypes.Add((ResultSetColumnTypes)(int)tuple![0]);
SchemaNames.Add((string)tuple[1]!);
}
}

[Obsolete]
public override bool Equals(object? obj)

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object?)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object?)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack edge] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'

Check warning on line 46 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.Equals(object?)' overrides non-obsolete member 'object.Equals(object)'
{
if (obj == null) return this == null;
Expand All @@ -61,6 +63,7 @@ public override bool Equals(object? obj)
&& Object.Equals(SchemaNames, header.SchemaNames);
}

[Obsolete]
public override int GetHashCode()

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack edge] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'

Check warning on line 67 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.GetHashCode()' overrides non-obsolete member 'object.GetHashCode()'
{
unchecked
Expand All @@ -72,8 +75,7 @@ public override int GetHashCode()
}
}



[Obsolete]
public override string ToString() =>

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / doctests

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack edge] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'

Check warning on line 79 in src/NRedisStack/Graph/Header.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 7.2.0-RC3] / Test

Obsolete member 'Header.ToString()' overrides non-obsolete member 'object.ToString()'
$"Header{{schemaTypes=[{string.Join(", ", SchemaTypes)}], schemaNames=[{string.Join(", ", SchemaNames)}]}}";
}
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/Graph/Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ internal Record(List<string> header, List<object> values)
/// </summary>
/// <param name="index">The index of the value that you want to get.</param>
/// <returns>The string value at the index that you specified.</returns>
public string GetString(int index) => Values[index].ToString();
public string GetString(int index) => Values[index].ToString()!;

/// <summary>
/// Gets the string representation of a value by key.
/// </summary>
/// <param name="key">The key of the value that you want to get.</param>
/// <returns>The string value at the key that you specified.</returns>
public string GetString(string key) => Values[Header.IndexOf(key)].ToString();
public string GetString(string key) => Values[Header.IndexOf(key)].ToString()!;

/// <summary>
/// Does the key exist in the record?
Expand Down
2 changes: 1 addition & 1 deletion src/NRedisStack/Graph/RedisGraphUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static string ValueToString(object value)
return ConvertibleToString(floatValue);
}

return value.ToString();
return value.ToString()!;
}

private static string ConvertibleToString(IConvertible floatValue)
Expand Down
54 changes: 27 additions & 27 deletions src/NRedisStack/Graph/ResultSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ internal ResultSet(RedisResult result, GraphCache graphCache)
{
if (result.Type == ResultType.Error)
{
throw new RedisServerException(result.ToString());
throw new RedisServerException(result.ToString()!);
}

Statistics = ParseStatistics(result);
Expand Down Expand Up @@ -131,16 +131,16 @@ private Node DeserializeNode(RedisResult[] rawNodeData)

DeserializeGraphEntityId(node, rawNodeData[0]);

var labelIndices = (int[])rawNodeData[1];
var labelIndices = (int[])rawNodeData[1]!;

foreach (var labelIndex in labelIndices)
{
var label = _graphCache.GetLabel(labelIndex);
var label = _graphCache!.GetLabel(labelIndex);

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

'GraphCache.GetLabel(int)' is obsolete

Check warning on line 138 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

'GraphCache.GetLabel(int)' is obsolete

node.Labels.Add(label);
}

DeserializeGraphEntityProperties(node, (RedisResult[])rawNodeData[2]);
DeserializeGraphEntityProperties(node, (RedisResult[])rawNodeData[2]!);

return node;
}
Expand All @@ -151,16 +151,16 @@ private Edge DeserializeEdge(RedisResult[] rawEdgeData)

DeserializeGraphEntityId(edge, rawEdgeData[0]);

edge.RelationshipType = _graphCache.GetRelationshipType((int)rawEdgeData[1]);
edge.RelationshipType = _graphCache!.GetRelationshipType((int)rawEdgeData[1]);

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

'GraphCache.GetRelationshipType(int)' is obsolete

Check warning on line 154 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

'GraphCache.GetRelationshipType(int)' is obsolete
edge.Source = (int)rawEdgeData[2];
edge.Destination = (int)rawEdgeData[3];

DeserializeGraphEntityProperties(edge, (RedisResult[])rawEdgeData[4]);
DeserializeGraphEntityProperties(edge, (RedisResult[])rawEdgeData[4]!);

return edge;
}

private object DeserializeScalar(RedisResult[] rawScalarData)
private object? DeserializeScalar(RedisResult[] rawScalarData)
{
var type = GetValueTypeFromObject(rawScalarData[0]);

Expand All @@ -169,25 +169,25 @@ private object DeserializeScalar(RedisResult[] rawScalarData)
case ResultSetScalarType.VALUE_NULL:
return null;
case ResultSetScalarType.VALUE_BOOLEAN:
return bool.Parse((string)rawScalarData[1]);
return bool.Parse((string)rawScalarData[1]!);
case ResultSetScalarType.VALUE_DOUBLE:
return (double)rawScalarData[1];
case ResultSetScalarType.VALUE_INT64:
return (long)rawScalarData[1];
case ResultSetScalarType.VALUE_STRING:
return (string)rawScalarData[1];
return (string)rawScalarData[1]!;
case ResultSetScalarType.VALUE_ARRAY:
return DeserializeArray((RedisResult[])rawScalarData[1]);
return DeserializeArray((RedisResult[])rawScalarData[1]!);
case ResultSetScalarType.VALUE_NODE:
return DeserializeNode((RedisResult[])rawScalarData[1]);
return DeserializeNode((RedisResult[])rawScalarData[1]!);
case ResultSetScalarType.VALUE_EDGE:
return DeserializeEdge((RedisResult[])rawScalarData[1]);
return DeserializeEdge((RedisResult[])rawScalarData[1]!);
case ResultSetScalarType.VALUE_PATH:
return DeserializePath((RedisResult[])rawScalarData[1]);
return DeserializePath((RedisResult[])rawScalarData[1]!);
case ResultSetScalarType.VALUE_MAP:
return DeserializeDictionary(rawScalarData[1]);
case ResultSetScalarType.VALUE_POINT:
return DeserializePoint((RedisResult[])rawScalarData[1]);
return DeserializePoint((RedisResult[])rawScalarData[1]!);
case ResultSetScalarType.VALUE_UNKNOWN:
default:
return (object)rawScalarData[1];
Expand All @@ -199,12 +199,12 @@ private static void DeserializeGraphEntityId(GraphEntity graphEntity, RedisResul

private void DeserializeGraphEntityProperties(GraphEntity graphEntity, RedisResult[] rawProperties)
{
foreach (RedisResult[] rawProperty in rawProperties)
foreach (RedisResult[]? rawProperty in rawProperties)
{
var Key = _graphCache.GetPropertyName((int)rawProperty[0]);
var Key = _graphCache!.GetPropertyName((int)rawProperty![0]);

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / doctests

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack cluster] / Test

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack edge] / Test

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack cluster] / Test

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 6.2.6] / Test

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 6 on [redis-stack 7.2.0-RC3] / Test

'GraphCache.GetPropertyName(int)' is obsolete

Check warning on line 204 in src/NRedisStack/Graph/ResultSet.cs

View workflow job for this annotation

GitHub Actions / .NET 7 on [redis-stack 6.2.6] / Test

'GraphCache.GetPropertyName(int)' is obsolete
var Value = DeserializeScalar(rawProperty.Skip(1).ToArray());

graphEntity.PropertyMap.Add(Key, Value);
graphEntity.PropertyMap.Add(Key, Value!);

}
}
Expand All @@ -215,24 +215,24 @@ private object[] DeserializeArray(RedisResult[] serializedArray)

for (var i = 0; i < serializedArray.Length; i++)
{
result[i] = DeserializeScalar((RedisResult[])serializedArray[i]);
result[i] = DeserializeScalar((RedisResult[])serializedArray[i]!)!;
}

return result;
}

private DataTypes.Path DeserializePath(RedisResult[] rawPath)
{
var deserializedNodes = (object[])DeserializeScalar((RedisResult[])rawPath[0]);
var deserializedNodes = (object[])DeserializeScalar((RedisResult[])rawPath[0]!)!;
var nodes = Array.ConvertAll(deserializedNodes, n => (Node)n);

var deserializedEdges = (object[])DeserializeScalar((RedisResult[])rawPath[1]);
var deserializedEdges = (object[])DeserializeScalar((RedisResult[])rawPath[1]!)!;
var edges = Array.ConvertAll(deserializedEdges, p => (Edge)p);

return new DataTypes.Path(nodes, edges);
}

private object DeserializePoint(RedisResult[] rawPath) // Should return Point?
private object? DeserializePoint(RedisResult[] rawPath) // Should return Point?
{
if (null == rawPath)
{
Expand All @@ -250,15 +250,15 @@ private DataTypes.Path DeserializePath(RedisResult[] rawPath)
// @SuppressWarnings("unchecked")
private Dictionary<string, object> DeserializeDictionary(RedisResult rawPath)
{
RedisResult[] keyTypeValueEntries = (RedisResult[])rawPath;
RedisResult[] keyTypeValueEntries = (RedisResult[])rawPath!;

int size = keyTypeValueEntries.Length;
Dictionary<string, object> dict = new Dictionary<string, object>(size / 2); // set the capacity to half of the list

for (int i = 0; i < size; i += 2)
{
string key = keyTypeValueEntries[i].ToString();
object value = DeserializeScalar((RedisResult[])keyTypeValueEntries[i + 1]);
string key = keyTypeValueEntries[i].ToString()!;
object value = DeserializeScalar((RedisResult[])keyTypeValueEntries[i + 1]!)!;
dict.Add(key, value);
}
return dict;
Expand All @@ -273,7 +273,7 @@ private static void ScanForErrors(RedisResult[] results)
{
if (result.Type == ResultType.Error)
{
throw new RedisServerException(result.ToString());
throw new RedisServerException(result.ToString()!);
}
}
}
Expand All @@ -284,7 +284,7 @@ private Statistics ParseStatistics(RedisResult result)

if (result.Type == ResultType.MultiBulk)
{
statistics = (RedisResult[])result;
statistics = (RedisResult[])result!;
}
else
{
Expand All @@ -294,7 +294,7 @@ private Statistics ParseStatistics(RedisResult result)
return new Statistics(
((RedisResult[])statistics).Select(x =>
{
var s = ((string)x).Split(':');
var s = ((string)x!).Split(':');
return new
{
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/Graph/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ internal Statistics(Dictionary<string, string> statistics)
RelationshipsDeleted = GetIntValue("Relationships deleted");
RelationshipsCreated = GetIntValue("Relationships created");
PropertiesSet = GetIntValue("Properties set");
QueryInternalExecutionTime = GetStringValue("Query internal execution time");
GraphRemovedInternalExecutionTime = GetStringValue("Graph removed, internal execution time");
QueryInternalExecutionTime = GetStringValue("Query internal execution time")!;
GraphRemovedInternalExecutionTime = GetStringValue("Graph removed, internal execution time")!;
CachedExecution = (GetIntValue("Cached execution") == 1);

}
Expand Down
2 changes: 1 addition & 1 deletion src/NRedisStack/Json/DataTypes/KeyValuePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public string[] ToArray()
{
if (Value is string)
{
return new string[] { Key, Path, Value.ToString() };
return new string[] { Key, Path, Value.ToString()! };
}
return new string[] { Key, Path, JsonSerializer.Serialize(Value) };
}
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/Json/JsonCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public RedisResult Get(RedisKey key, string[] paths, RedisValue? indent = null,
public IEnumerable<T?> GetEnumerable<T>(RedisKey key, string path = "$")
{
RedisResult res = _db.Execute(JsonCommandBuilder.Get<T>(key, path));
return JsonSerializer.Deserialize<IEnumerable<T>>(res.ToString());
return JsonSerializer.Deserialize<IEnumerable<T>>(res.ToString()!)!;
}

/// <inheritdoc/>
Expand All @@ -254,7 +254,7 @@ public RedisResult[] MGet(RedisKey[] keys, string path)
public double?[] NumIncrby(RedisKey key, string path, double value)
{
var res = _db.Execute(JsonCommandBuilder.NumIncrby(key, path, value));
return JsonSerializer.Deserialize<double?[]>(res.ToString());
return JsonSerializer.Deserialize<double?[]>(res.ToString()!)!;
}

/// <inheritdoc/>
Expand Down
1 change: 1 addition & 0 deletions src/NRedisStack/ModulePrefixes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static class ModulePrefixes

public static CmsCommands CMS(this IDatabase db) => new CmsCommands(db);

[Obsolete]
public static GraphCommands GRAPH(this IDatabase db) => new GraphCommands(db);

public static TopKCommands TOPK(this IDatabase db) => new TopKCommands(db);
Expand Down
2 changes: 2 additions & 0 deletions src/NRedisStack/Pipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public Pipeline(IDatabase db)
public BloomCommandsAsync Bf => new BloomCommandsAsync(_batch);
public CmsCommandsAsync Cms => new CmsCommandsAsync(_batch);
public CuckooCommandsAsync Cf => new CuckooCommandsAsync(_batch);

[Obsolete]
public GraphCommandsAsync Graph => new GraphCommandsAsync(_batch);
public JsonCommandsAsync Json => new JsonCommandsAsync(_batch);
public SearchCommandsAsync Ft => new SearchCommandsAsync(_batch);
Expand Down
Loading

0 comments on commit a488f2a

Please sign in to comment.