pub struct GraphResponse<T = GraphValue>where
T: FromGraphValue,{
pub header: Vec<String>,
pub data: Vec<T>,
pub statistics: Vec<String>,
}
Expand description
§Overview
Response type from redis graph
This type is generic over the a type that should represent the return value of each match in the query
For example a query like:
MATCH (a:User {name: ‘You’}) RETURN a
Will return a Vec of whatever stands in the return clause
but the generic type in this case should not be Node
it should be (Node,)
as there can be multiple comma seperated items returned by a single matched pattern.
Fields§
§header: Vec<String>
List of return type names e.g. RETURN item, otheritem will result in vec![“item”, “otheritem”] This info is largely useless
data: Vec<T>
Every item of data represents one match of a request each T is than the type returned by the return clause which is always a tuple- Even for RETURN 1 should be (i32, ) not i32 as there can always be multiple items returned from a single return clause
statistics: Vec<String>
Statistics of the query e.g. “Cached execution: 1” or “Query internal execution time: 0.01337 milliseconds”
Implementations§
Source§impl<T: FromGraphValue> GraphResponse<T>
impl<T: FromGraphValue> GraphResponse<T>
Sourcepub fn parse_response(value: &Value) -> RedisResult<GraphResponse<T>>
pub fn parse_response(value: &Value) -> RedisResult<GraphResponse<T>>
Parses a redis::Value
into a RedisResult<GraphResponse<T>>
Sourcepub fn get_statistic(&self, stat: GraphStatistic) -> Option<f64>
pub fn get_statistic(&self, stat: GraphStatistic) -> Option<f64>
Try to get the value of the requested statistic
Trait Implementations§
Source§impl<T> Debug for GraphResponse<T>where
T: FromGraphValue + Debug,
impl<T> Debug for GraphResponse<T>where
T: FromGraphValue + Debug,
Source§impl<T: FromGraphValue> FromRedisValue for GraphResponse<T>
impl<T: FromGraphValue> FromRedisValue for GraphResponse<T>
Source§fn from_redis_value(v: &Value) -> RedisResult<GraphResponse<T>>
fn from_redis_value(v: &Value) -> RedisResult<GraphResponse<T>>
Value
this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
from_redis_value
but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples.