pub struct GraphQLSchema { /* private fields */ }Implementations§
Source§impl GraphQLSchema
impl GraphQLSchema
pub fn new() -> Self
Sourcepub fn with_limits(self, limits: QueryLimits) -> Self
pub fn with_limits(self, limits: QueryLimits) -> Self
配置执行前查询预算(防查询放大 DoS),默认已启用。
pub fn query( self, name: impl Into<String>, r: Arc<dyn Fn(Value) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>> + Send + Sync>, ) -> Self
pub fn mutation( self, name: impl Into<String>, r: Arc<dyn Fn(Value) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>> + Send + Sync>, ) -> Self
pub fn query_fn( self, name: impl Into<String>, f: impl Fn(Value) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>> + Send + Sync + 'static, ) -> Self
Sourcepub fn query_field(
self,
name: impl Into<String>,
f: impl GraphQLField + 'static,
) -> Self
pub fn query_field( self, name: impl Into<String>, f: impl GraphQLField + 'static, ) -> Self
注册富 query resolver:接收 FieldRequest(参数 + 嵌套 selection)。
Sourcepub fn mutation_field(
self,
name: impl Into<String>,
f: impl GraphQLField + 'static,
) -> Self
pub fn mutation_field( self, name: impl Into<String>, f: impl GraphQLField + 'static, ) -> Self
注册富 mutation resolver:接收 FieldRequest(参数 + 嵌套 selection)。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphQLSchema
impl !UnwindSafe for GraphQLSchema
impl Freeze for GraphQLSchema
impl Send for GraphQLSchema
impl Sync for GraphQLSchema
impl Unpin for GraphQLSchema
impl UnsafeUnpin for GraphQLSchema
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