pub struct SurrealResponseData {
pub id: String,
pub result: SurrealResponseResult,
}
Expand description
A raw, unparsed, response from the SurrealDB instance.
A surreal response always looks like the following:
// SELECT ->manage->Project as projects, * from Account;
[
{ // <-- SurrealQueryResult: one object for each query passed in the request
"time": "229.2µs",
"status": "OK",
"result": [
{ // <-- one object for each returned row
"projects": [...],
// ... the rest of the fields from the Account node and returned by the
// * selector:
"id": "...",
"username": "..."
}
]
},
]
The SurrealResponseData::result
field holds a serde::Value
that represents
such JSON. However it is recommended to use the SurrealResponseData methods
to make retrieving data easier.
Fields§
§id: String
§result: SurrealResponseResult
Implementations§
Source§impl SurrealResponseData
impl SurrealResponseData
Sourcepub fn get_nth_query_result(&self, n: usize) -> Option<&SurrealQueryResult>
pub fn get_nth_query_result(&self, n: usize) -> Option<&SurrealQueryResult>
Get the result of the n
-th query out of the resulting JSON. Refer to the
SurrealResponseData description to understand what the resulting JSON
looks like and what object will be returned by this function.
If the response doesn’t contain any data then None is immediately returned
Trait Implementations§
Source§impl Debug for SurrealResponseData
impl Debug for SurrealResponseData
Source§impl<'de> Deserialize<'de> for SurrealResponseData
impl<'de> Deserialize<'de> for SurrealResponseData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SurrealResponseData
impl RefUnwindSafe for SurrealResponseData
impl Send for SurrealResponseData
impl Sync for SurrealResponseData
impl Unpin for SurrealResponseData
impl UnwindSafe for SurrealResponseData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more