public T HGet <T>(string key, string field) { ValidateKeyVal(key); ValidateFieldVal(field); var command = new HGetCommand <T>(key, field); return(command.Execute()); }
private string PerformHGet(HGetCommand command) { if (_storage.TryGetValue(command.Key, out var value)) { if (value is HashValue hv) { if (!hv.Value.ContainsKey(command.Value)) { return($"No such element in database associated with key {command.Key}"); } return(hv.Value[command.Value]); } return($"Type associated with key {command.Key} is not a hash-value type"); } return("Key does not exists"); }