Struct GraphResponse

Source
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>

Source

pub fn parse_response(value: &Value) -> RedisResult<GraphResponse<T>>

Parses a redis::Value into a RedisResult<GraphResponse<T>>

Source

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,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: FromGraphValue> FromRedisValue for GraphResponse<T>

Source§

fn from_redis_value(v: &Value) -> RedisResult<GraphResponse<T>>

Given a redis 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>

Similar to 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.

Auto Trait Implementations§

§

impl<T> Freeze for GraphResponse<T>

§

impl<T> RefUnwindSafe for GraphResponse<T>
where T: RefUnwindSafe,

§

impl<T> Send for GraphResponse<T>
where T: Send,

§

impl<T> Sync for GraphResponse<T>
where T: Sync,

§

impl<T> Unpin for GraphResponse<T>
where T: Unpin,

§

impl<T> UnwindSafe for GraphResponse<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,