Struct aragog::query::JsonQueryResult [−][src]
Result of a succeeded Query
. Contains a Vec
of serde_json
::Value
.
The structure has methods to retrieve typed models (get_records
).
Fields
documents: Vec<Value>
Vector of the returned documents
Implementations
impl JsonQueryResult
[src]
pub fn new(documents: Vec<Value>) -> Self
[src]
Instantiates a new JsonQueryResult
from a document collection
pub fn get_records<T: Record>(&self) -> Vec<DatabaseRecord<T>>
[src]
Retrieves deserialized documents from the json results. The documents not matching T
will not be returned.
Example
If you want to do a graph query that can return different models you can use this method to retrieve the serialized record:
let json_results = Query::outbound(1, 5, "ChildOf", "User/123").call(&db_accessor).await.unwrap(); let user_results = json_results.get_records::<User>(); let topic_results = json_results.get_records::<Topic>(); let role_results = json_results.get_records::<Role>();
pub fn len(&self) -> usize
[src]
Returns the length of documents
pub fn is_empty(&self) -> bool
[src]
Returns true
if no documents were returned
Trait Implementations
impl Debug for JsonQueryResult
[src]
impl<T: Record> From<JsonQueryResult> for RecordQueryResult<T>
[src]
fn from(query_result: JsonQueryResult) -> Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for JsonQueryResult
impl Send for JsonQueryResult
impl Sync for JsonQueryResult
impl Unpin for JsonQueryResult
impl UnwindSafe for JsonQueryResult
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,