pub struct CascadeResponseParser;Expand description
Parser for GraphQL Cascade responses following the Cascade specification v1.1.
Extracts all affected entities from mutation responses to enable entity-level cache invalidation.
Implementations§
Source§impl CascadeResponseParser
impl CascadeResponseParser
Sourcepub fn parse_cascade_response(
&self,
response: &Value,
) -> Result<CascadeEntities>
pub fn parse_cascade_response( &self, response: &Value, ) -> Result<CascadeEntities>
Parse cascade data from a GraphQL mutation response.
§Arguments
response- The full GraphQL response containing cascade field
§Returns
CascadeEntities with all updated and deleted entities
§Examples
use fraiseql_core::cache::CascadeResponseParser;
use serde_json::json;
let parser = CascadeResponseParser::new();
let response = json!({
"createPost": {
"cascade": {
"updated": [
{ "__typename": "User", "id": "uuid-123" }
]
}
}
});
let entities = parser.parse_cascade_response(&response)?;
assert_eq!(entities.updated.len(), 1);§Errors
Returns FraiseQLError::Validation if the cascade field is present but
malformed (e.g., updated or deleted is not an array, or an entity is
missing __typename / id).
Trait Implementations§
Source§impl Clone for CascadeResponseParser
impl Clone for CascadeResponseParser
Source§fn clone(&self) -> CascadeResponseParser
fn clone(&self) -> CascadeResponseParser
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CascadeResponseParser
impl Debug for CascadeResponseParser
Auto Trait Implementations§
impl Freeze for CascadeResponseParser
impl RefUnwindSafe for CascadeResponseParser
impl Send for CascadeResponseParser
impl Sync for CascadeResponseParser
impl Unpin for CascadeResponseParser
impl UnsafeUnpin for CascadeResponseParser
impl UnwindSafe for CascadeResponseParser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more