pub struct CascadeMetadata { /* private fields */ }Expand description
Maps mutation names to the entity types they modify.
Built from compiled schema, this metadata enables determining which entities are affected by each mutation operation.
Implementations§
Source§impl CascadeMetadata
impl CascadeMetadata
Sourcepub fn new() -> Self
pub fn new() -> Self
Create empty cascade metadata.
Useful when building metadata programmatically or in tests.
Sourcepub fn add_mutation(&mut self, mutation_name: &str, entity_type: &str)
pub fn add_mutation(&mut self, mutation_name: &str, entity_type: &str)
Add a mutation-to-entity mapping.
§Arguments
mutation_name- Name of the mutation (e.g., “createUser”)entity_type- Type of entity it modifies (e.g., “User”)
Sourcepub fn get_entity_type(&self, mutation_name: &str) -> Option<&str>
pub fn get_entity_type(&self, mutation_name: &str) -> Option<&str>
Get the entity type modified by a mutation.
§Arguments
mutation_name- Name of the mutation
§Returns
Some(&str)- Entity type if mutation is knownNone- If mutation is not in schema
§Examples
use fraiseql_core::cache::cascade_metadata::CascadeMetadata;
let mut metadata = CascadeMetadata::new();
metadata.add_mutation("createUser", "User");
let entity = metadata.get_entity_type("createUser");
assert_eq!(entity, Some("User"));Sourcepub fn get_mutations_for_entity(&self, entity_type: &str) -> Vec<String>
pub fn get_mutations_for_entity(&self, entity_type: &str) -> Vec<String>
Sourcepub fn contains_mutation(&self, mutation_name: &str) -> bool
pub fn contains_mutation(&self, mutation_name: &str) -> bool
Check if metadata contains a mutation.
Sourcepub fn from_schema(schema: &CompiledSchema) -> Self
pub fn from_schema(schema: &CompiledSchema) -> Self
Build cascade metadata from a compiled schema.
Extracts all mutations from the schema and maps each to the entity type it returns. Called during server initialization to pre-build the mapping for use by the cache invalidation system.
Trait Implementations§
Source§impl Clone for CascadeMetadata
impl Clone for CascadeMetadata
Source§fn clone(&self) -> CascadeMetadata
fn clone(&self) -> CascadeMetadata
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 CascadeMetadata
impl Debug for CascadeMetadata
Auto Trait Implementations§
impl Freeze for CascadeMetadata
impl RefUnwindSafe for CascadeMetadata
impl Send for CascadeMetadata
impl Sync for CascadeMetadata
impl Unpin for CascadeMetadata
impl UnsafeUnpin for CascadeMetadata
impl UnwindSafe for CascadeMetadata
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