public ResultProjectionInfo( RedisResultInfo result, ResultProjectionKind kind, int?index = null) : this(result, kind, default(byte[]), index) { }
public ResultProjectionInfo( RedisResultInfo result, ResultProjectionKind kind, string value, int?index = null) : this(result, kind, Encoding.UTF8.GetBytes(value), index) { }
public ResultProjectionInfo( RedisResultInfo result, ResultProjectionKind kind, long value, int?index = null) : this(result, kind, value.ToString(), index) { }
public ResultProjectionInfo( RedisResultInfo result, ResultProjectionKind kind, byte[] value, int?index = null) { Result = result; Kind = kind; Value = value; Index = index; }
private ResultProjectionInfo ProjectBulkInfo( RedisResultInfo.Bulk bulk, ResultProjectionKind kind = ResultProjectionKind.None) { if (kind == ResultProjectionKind.None) { var commandInfo = bulk.CommandInfo; var commandName = commandInfo?.Name?.ToLowerInvariant(); switch (commandName) { // Strings case "set": case "mset": kind = ResultProjectionKind.Status; break; case "get": kind = ResultProjectionKind.Value; break; // Lists case "lindex": case "linsert": case "llen": case "lpop": case "lpush": case "lpushx": case "lrem": case "rpop": case "rpoplpush": case "rpush": case "rpushx": kind = ResultProjectionKind.Value; break; case "lset": case "ltrim": kind = ResultProjectionKind.Status; break; // Hashes case "hget": case "hset": kind = ResultProjectionKind.Value; break; // Sets case "sadd": case "srem": kind = ResultProjectionKind.Value; break; // Sorted Sets case "zadd": case "zrem": kind = ResultProjectionKind.Value; break; default: kind = ResultProjectionKind.Value; break; } } return(new ResultProjectionInfo( bulk, kind, bulk.Bytes)); }