pub struct MutationDefinition {
pub name: String,
pub return_type: String,
pub arguments: Vec<ArgumentDefinition>,
pub description: Option<String>,
pub operation: MutationOperation,
pub deprecation: Option<DeprecationInfo>,
}Expand description
A mutation definition compiled from @fraiseql.mutation.
Mutations are declarative bindings to database functions. They describe which function to call, not arbitrary logic.
§Example
use fraiseql_core::schema::{MutationDefinition, MutationOperation};
let mutation = MutationDefinition {
name: "createUser".to_string(),
return_type: "User".to_string(),
arguments: vec![],
description: Some("Create a new user".to_string()),
operation: MutationOperation::Insert { table: "users".to_string() },
deprecation: None,
};Fields§
§name: StringMutation name (e.g., “createUser”).
return_type: StringReturn type name.
arguments: Vec<ArgumentDefinition>Input arguments.
description: Option<String>Description.
operation: MutationOperationSQL operation type.
deprecation: Option<DeprecationInfo>Deprecation information (from @deprecated directive). When set, this mutation is marked as deprecated in the schema.
Implementations§
Source§impl MutationDefinition
impl MutationDefinition
Sourcepub fn new(name: impl Into<String>, return_type: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, return_type: impl Into<String>) -> Self
Create a new mutation definition.
Sourcepub fn deprecated(self, reason: Option<String>) -> Self
pub fn deprecated(self, reason: Option<String>) -> Self
Mark this mutation as deprecated.
§Example
use fraiseql_core::schema::MutationDefinition;
let mutation = MutationDefinition::new("oldCreateUser", "User")
.deprecated(Some("Use 'createUser' instead".to_string()));
assert!(mutation.is_deprecated());Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
Check if this mutation is deprecated.
Sourcepub fn deprecation_reason(&self) -> Option<&str>
pub fn deprecation_reason(&self) -> Option<&str>
Get the deprecation reason if deprecated.
Trait Implementations§
Source§impl Clone for MutationDefinition
impl Clone for MutationDefinition
Source§fn clone(&self) -> MutationDefinition
fn clone(&self) -> MutationDefinition
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 MutationDefinition
impl Debug for MutationDefinition
Source§impl<'de> Deserialize<'de> for MutationDefinition
impl<'de> Deserialize<'de> for MutationDefinition
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
Source§impl PartialEq for MutationDefinition
impl PartialEq for MutationDefinition
Source§impl Serialize for MutationDefinition
impl Serialize for MutationDefinition
impl StructuralPartialEq for MutationDefinition
Auto Trait Implementations§
impl Freeze for MutationDefinition
impl RefUnwindSafe for MutationDefinition
impl Send for MutationDefinition
impl Sync for MutationDefinition
impl Unpin for MutationDefinition
impl UnwindSafe for MutationDefinition
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