Struct redis_graph::GraphResult
source · pub struct GraphResult {
pub data: HashMap<String, GraphValue>,
}
Expand description
A graph query can return one or multiple values for every matching entry. A GraphResult contains a map of values for a single match. The map keys are the query RETURN statements, values can be of any GraphValue type in any order. The impl also contains some helper methods for easier extraction of graph values.
use redis_graph::GraphResult;
let res = GraphResult::default();
let name:Option<String> = res.get_scalar("person2.name");
let person = res.get_node("person");
let friend_rel = res.get_relation("friend");
Fields§
§data: HashMap<String, GraphValue>
A map of raw return keys to GraphValues.
Implementations§
source§impl GraphResult
impl GraphResult
Represents a group of returned graph values for a single matched result in the query. Contains some helper methods for easier extraction of graph values.
sourcepub fn get_value(&self, key: &str) -> Option<&GraphValue>
pub fn get_value(&self, key: &str) -> Option<&GraphValue>
Returns a single GraphValue by it’s key.
sourcepub fn get_scalar<T: FromRedisValue>(&self, key: &str) -> Option<T>
pub fn get_scalar<T: FromRedisValue>(&self, key: &str) -> Option<T>
Tries to extract a graph Scalar value into target type T. Will return None in case the key does not exist, the target value is not a Scalar or the value could not be parsed into T.
sourcepub fn get_node(&self, key: &str) -> Option<&NodeValue>
pub fn get_node(&self, key: &str) -> Option<&NodeValue>
Tries to extract a graph Node value from Value at key. Will return
None in case the key does not exist or the target value is not a
Node.
sourcepub fn get_relation(&self, key: &str) -> Option<&RelationValue>
pub fn get_relation(&self, key: &str) -> Option<&RelationValue>
Tries to extract a graph Relation value from Value at key. Will return
None in case the key does not exist or the target value is not a
Relation.
Trait Implementations§
source§impl Clone for GraphResult
impl Clone for GraphResult
source§fn clone(&self) -> GraphResult
fn clone(&self) -> GraphResult
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more