Skip to main content

SchemaExtensions

Struct SchemaExtensions 

Source
pub struct SchemaExtensions {
    pub relations: Vec<Relation>,
    pub mutations: Vec<(String, MutationKind)>,
    pub subscriptions: Vec<String>,
}
Expand description

Schema 扩展配置

将关联关系、分页类型、变更、订阅等扩展信息附加到既有 schema

Fields§

§relations: Vec<Relation>

关联关系列表

§mutations: Vec<(String, MutationKind)>

变更定义列表(类型名 + 操作类型)

§subscriptions: Vec<String>

订阅主题列表

Implementations§

Source§

impl SchemaExtensions

Source

pub fn new() -> Self

Source

pub fn with_relation(self, relation: Relation) -> Self

添加关联关系

Source

pub fn with_mutation( self, type_name: impl Into<String>, kind: MutationKind, ) -> Self

添加变更定义

Source

pub fn with_subscription(self, topic: impl Into<String>) -> Self

添加订阅主题

Source

pub fn to_sdl(&self) -> String

将扩展信息渲染为 SDL 片段

Trait Implementations§

Source§

impl Default for SchemaExtensions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.