pub struct ParsedGraphQLSchema { /* private fields */ }
Expand description

A wrapper object used to encapsulate a lot of the boilerplate logic related to parsing schema, creating mappings of types, fields, objects, etc.

Implementations§

source§

impl ParsedGraphQLSchema

source

pub fn new( namespace: &str, identifier: &str, exec_source: ExecutionSource, schema: Option<&GraphQLSchema> ) -> ParsedResult<Self>

Create a new ParsedGraphQLSchema.

source

pub fn namespace(&self) -> &str

Namespace of the indexer.

source

pub fn identifier(&self) -> &str

Identifier of the indexer.

source

pub fn exec_source(&self) -> &ExecutionSource

Indexer method of execution.

source

pub fn objects(&self) -> &HashMap<String, ObjectType>

Mapping of object names to objects.

source

pub fn field_type_mappings(&self) -> &HashMap<String, String>

Mapping of fully qualified field names to their field types.

source

pub fn field_type_optionality(&self) -> &HashMap<String, bool>

A mapping of fully qualified field names to their respective optionalities.

source

pub fn ast(&self) -> &ServiceDocument

The parsed schema AST.

source

pub fn schema(&self) -> &GraphQLSchema

Raw GraphQL schema content.

source

pub fn type_defs(&self) -> &HashMap<String, TypeDefinition>

All type definitions in the schema.

source

pub fn field_defs(&self) -> &HashMap<String, (FieldDefinition, String)>

Mapping of fully qualified field names to their FieldDefinition and TypeDefinition name.

source

pub fn foreign_key_mappings( &self ) -> &HashMap<String, HashMap<String, (String, String)>>

All unique names of foreign key types in the schema.

source

pub fn object_field_mappings( &self ) -> &HashMap<String, BTreeMap<String, String>>

All objects and their field names and types, indexed by object name.

source

pub fn join_table_meta(&self) -> &HashMap<String, JoinTableMeta>

Metadata related to many-to-many relationships in the GraphQL schema.

source

pub fn scalar_type_for(&self, f: &FieldDefinition) -> String

Return the base scalar type for a given FieldDefinition.

source

pub fn get_union(&self, name: &str) -> Option<&TypeDefinition>

Return the TypeDefinition associated with a given union name.

source

pub fn non_enum_typdefs(&self) -> Vec<(&String, &TypeDefinition)>

Return a list of all non-enum type definitions.

source

pub fn is_possible_foreign_key(&self, name: &str) -> bool

Whether the given field type name is a possible foreign key.

source

pub fn is_virtual_typedef(&self, name: &str) -> bool

Whether the given field type name is a type from which tables are not created.

source

pub fn is_enum_typedef(&self, name: &str) -> bool

Whether the given field type name is an enum type.

source

pub fn is_list_field_type(&self, name: &str) -> bool

Whether the given field type name is a list type.

source

pub fn is_list_typedef(&self, name: &str) -> bool

Whether a given TypeDefinition contains a field that is a list type.

source

pub fn is_union_typedef(&self, name: &str) -> bool

Whether the given field type name is a union type.

source

pub fn graphql_type(&self, cond: Option<&String>, name: &str) -> Option<&String>

Return the GraphQL type for a given FieldDefinition or TypeDefinition name.

source

pub fn has_type(&self, name: &str) -> bool

Ensure the given type is included in this Schema’s types

source

pub fn fully_qualified_namespace(&self) -> String

Fully qualified GraphQL namespace for indexer.

Trait Implementations§

source§

impl Clone for ParsedGraphQLSchema

source§

fn clone(&self) -> ParsedGraphQLSchema

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ParsedGraphQLSchema

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ParsedGraphQLSchema

source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more