Exemple #1
0
 public static StreamsEntryResult[] ThrowOrValueToXRead(this RedisResult rt) =>
 rt.ThrowOrValue((a, _) =>
 {
     if (a == null)
     {
         return(new StreamsEntryResult[0]);
     }
     var ret = new StreamsEntryResult[a.Length];
     for (var z = 0; z < a.Length; z++)
     {
         var objs1   = a[z] as object[];
         var objs2   = objs1[1] as object[];
         var entries = new StreamsEntry[objs2.Length];
         ret[z]      = new StreamsEntryResult {
             key = objs1[0].ConvertTo <string>(), entries = entries
         };
         for (var y = 0; y < objs2.Length; y++)
         {
             var objs3  = objs2[y] as object[];
             entries[y] = new StreamsEntry {
                 id = objs3[0].ConvertTo <string>(), fieldValues = objs3[1] as object[]
             };
         }
     }
     return(ret);
 });
Exemple #2
0
 public static StreamsEntry[] ThrowOrValueToStreamsEntryArray(this RedisResult rt) =>
 rt.ThrowOrValue((a, _) =>
 {
     if (a == null)
     {
         return(new StreamsEntry[0]);
     }
     var entries = new StreamsEntry[a.Length];
     for (var z = 0; z < a.Length; z++)
     {
         var objs1 = a[z] as object[];
         if (objs1 == null)
         {
             continue;
         }
         entries[z] = new StreamsEntry {
             id = objs1[0].ConvertTo <string>(), fieldValues = objs1[1] as object[]
         };
     }
     return(entries);
 });