Trait apollo_compiler::database::HirDatabase
source · pub trait HirDatabase: Database + HasQueryGroup<HirStorage> + InputDatabase + AstDatabase {
Show 41 methods
// Required methods
fn type_system_definitions(&self) -> Arc<TypeSystemDefinitions>;
fn type_system(&self) -> Arc<TypeSystem>;
fn extensions(&self) -> Arc<Vec<TypeExtension>>;
fn operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>;
fn fragments(&self, key0: FileId) -> ByName<FragmentDefinition>;
fn all_operations(&self) -> Arc<Vec<Arc<OperationDefinition>>>;
fn all_fragments(&self) -> ByName<FragmentDefinition>;
fn schema(&self) -> Arc<SchemaDefinition>;
fn object_types(&self) -> ByName<ObjectTypeDefinition>;
fn object_types_with_built_ins(&self) -> ByName<ObjectTypeDefinition>;
fn scalars(&self) -> ByName<ScalarTypeDefinition>;
fn enums(&self) -> ByName<EnumTypeDefinition>;
fn enums_with_built_ins(&self) -> ByName<EnumTypeDefinition>;
fn unions(&self) -> ByName<UnionTypeDefinition>;
fn interfaces(&self) -> ByName<InterfaceTypeDefinition>;
fn directive_definitions(&self) -> ByName<DirectiveDefinition>;
fn input_objects(&self) -> ByName<InputObjectTypeDefinition>;
fn find_operation(
&self,
key0: FileId,
key1: Option<String>
) -> Option<Arc<OperationDefinition>>;
fn find_fragment_by_name(
&self,
key0: FileId,
key1: String
) -> Option<Arc<FragmentDefinition>>;
fn find_object_type_by_name(
&self,
key0: String
) -> Option<Arc<ObjectTypeDefinition>>;
fn find_union_by_name(
&self,
key0: String
) -> Option<Arc<UnionTypeDefinition>>;
fn find_enum_by_name(&self, key0: String) -> Option<Arc<EnumTypeDefinition>>;
fn find_scalar_by_name(
&self,
key0: String
) -> Option<Arc<ScalarTypeDefinition>>;
fn find_interface_by_name(
&self,
key0: String
) -> Option<Arc<InterfaceTypeDefinition>>;
fn find_directive_definition_by_name(
&self,
key0: String
) -> Option<Arc<DirectiveDefinition>>;
fn find_types_with_directive(
&self,
key0: String
) -> Arc<Vec<TypeDefinition>>;
fn find_input_object_by_name(
&self,
key0: String
) -> Option<Arc<InputObjectTypeDefinition>>;
fn types_definitions_by_name(&self) -> Arc<IndexMap<String, TypeDefinition>>;
fn find_type_definition_by_name(
&self,
key0: String
) -> Option<TypeDefinition>;
fn query_operations(
&self,
key0: FileId
) -> Arc<Vec<Arc<OperationDefinition>>>;
fn mutation_operations(
&self,
key0: FileId
) -> Arc<Vec<Arc<OperationDefinition>>>;
fn subscription_operations(
&self,
key0: FileId
) -> Arc<Vec<Arc<OperationDefinition>>>;
fn operation_fields(&self, key0: SelectionSet) -> Arc<Vec<Field>>;
fn operation_inline_fragment_fields(
&self,
key0: SelectionSet
) -> Arc<Vec<Field>>;
fn operation_fragment_spread_fields(
&self,
key0: SelectionSet
) -> Arc<Vec<Field>>;
fn operation_fragment_references(
&self,
key0: SelectionSet
) -> Arc<Vec<Arc<FragmentDefinition>>>;
fn flattened_operation_fields(&self, key0: SelectionSet) -> Vec<Arc<Field>>;
fn selection_variables(&self, key0: SelectionSet) -> Arc<HashSet<Variable>>;
fn operation_definition_variables(
&self,
key0: Arc<Vec<VariableDefinition>>
) -> Arc<HashSet<Variable>>;
fn subtype_map(&self) -> Arc<HashMap<String, HashSet<String>>>;
fn is_subtype(&self, key0: String, key1: String) -> bool;
}Required Methods§
sourcefn type_system_definitions(&self) -> Arc<TypeSystemDefinitions>
fn type_system_definitions(&self) -> Arc<TypeSystemDefinitions>
Return all type system definitions defined in the compiler.
sourcefn type_system(&self) -> Arc<TypeSystem>
fn type_system(&self) -> Arc<TypeSystem>
Return a TypeSystem containing definitions and more.
This can be used with set_type_system_hir
on another compiler.
sourcefn extensions(&self) -> Arc<Vec<TypeExtension>>
fn extensions(&self) -> Arc<Vec<TypeExtension>>
Return all the extensions defined in the type system.
sourcefn operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>
fn operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>
Return all the operations defined in a file.
sourcefn fragments(&self, key0: FileId) -> ByName<FragmentDefinition>
fn fragments(&self, key0: FileId) -> ByName<FragmentDefinition>
Return all the fragments defined in a file.
sourcefn all_operations(&self) -> Arc<Vec<Arc<OperationDefinition>>>
fn all_operations(&self) -> Arc<Vec<Arc<OperationDefinition>>>
Return all the operations defined in any file.
sourcefn all_fragments(&self) -> ByName<FragmentDefinition>
fn all_fragments(&self) -> ByName<FragmentDefinition>
Return all the fragments defined in any file.
sourcefn schema(&self) -> Arc<SchemaDefinition>
fn schema(&self) -> Arc<SchemaDefinition>
Return schema definition defined in the compiler.
sourcefn object_types(&self) -> ByName<ObjectTypeDefinition>
fn object_types(&self) -> ByName<ObjectTypeDefinition>
Return all object type definitions defined in the compiler.
sourcefn object_types_with_built_ins(&self) -> ByName<ObjectTypeDefinition>
fn object_types_with_built_ins(&self) -> ByName<ObjectTypeDefinition>
Return all object type definitions, including instrospection types like
__Schema, defined in the compiler.
sourcefn scalars(&self) -> ByName<ScalarTypeDefinition>
fn scalars(&self) -> ByName<ScalarTypeDefinition>
Return all scalar type definitions defined in the compiler.
sourcefn enums(&self) -> ByName<EnumTypeDefinition>
fn enums(&self) -> ByName<EnumTypeDefinition>
Return all enum type definitions defined in the compiler.
sourcefn enums_with_built_ins(&self) -> ByName<EnumTypeDefinition>
fn enums_with_built_ins(&self) -> ByName<EnumTypeDefinition>
Return all enums, including introspection types like __TypeKind, defined
in the compiler.
sourcefn unions(&self) -> ByName<UnionTypeDefinition>
fn unions(&self) -> ByName<UnionTypeDefinition>
Return all union type definitions defined in the compiler.
sourcefn interfaces(&self) -> ByName<InterfaceTypeDefinition>
fn interfaces(&self) -> ByName<InterfaceTypeDefinition>
Return all interface type definitions defined in the compiler.
sourcefn directive_definitions(&self) -> ByName<DirectiveDefinition>
fn directive_definitions(&self) -> ByName<DirectiveDefinition>
Return all directive definitions defined in the compiler.
sourcefn input_objects(&self) -> ByName<InputObjectTypeDefinition>
fn input_objects(&self) -> ByName<InputObjectTypeDefinition>
Return all input object type definitions defined in the compiler.
sourcefn find_operation(
&self,
key0: FileId,
key1: Option<String>
) -> Option<Arc<OperationDefinition>>
fn find_operation( &self, key0: FileId, key1: Option<String> ) -> Option<Arc<OperationDefinition>>
Return an operation definition corresponding to the name and file id.
If name is None, and there is only one operation, that operation will
be returned.
If name is None, and there is more than one operation, None will
be returned.
sourcefn find_fragment_by_name(
&self,
key0: FileId,
key1: String
) -> Option<Arc<FragmentDefinition>>
fn find_fragment_by_name( &self, key0: FileId, key1: String ) -> Option<Arc<FragmentDefinition>>
Return an fragment definition corresponding to the name and file id. Result of this query is not cached internally.
sourcefn find_object_type_by_name(
&self,
key0: String
) -> Option<Arc<ObjectTypeDefinition>>
fn find_object_type_by_name( &self, key0: String ) -> Option<Arc<ObjectTypeDefinition>>
Return an object type definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_union_by_name(&self, key0: String) -> Option<Arc<UnionTypeDefinition>>
fn find_union_by_name(&self, key0: String) -> Option<Arc<UnionTypeDefinition>>
Return an union type definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_enum_by_name(&self, key0: String) -> Option<Arc<EnumTypeDefinition>>
fn find_enum_by_name(&self, key0: String) -> Option<Arc<EnumTypeDefinition>>
Return an enum type definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_scalar_by_name(&self, key0: String) -> Option<Arc<ScalarTypeDefinition>>
fn find_scalar_by_name(&self, key0: String) -> Option<Arc<ScalarTypeDefinition>>
Return a scalar type definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_interface_by_name(
&self,
key0: String
) -> Option<Arc<InterfaceTypeDefinition>>
fn find_interface_by_name( &self, key0: String ) -> Option<Arc<InterfaceTypeDefinition>>
Return an interface type definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_directive_definition_by_name(
&self,
key0: String
) -> Option<Arc<DirectiveDefinition>>
fn find_directive_definition_by_name( &self, key0: String ) -> Option<Arc<DirectiveDefinition>>
Return an directive definition corresponding to the name. Result of this query is not cached internally.
sourcefn find_types_with_directive(&self, key0: String) -> Arc<Vec<TypeDefinition>>
fn find_types_with_directive(&self, key0: String) -> Arc<Vec<TypeDefinition>>
Return any type definitions that contain the corresponding directive
sourcefn find_input_object_by_name(
&self,
key0: String
) -> Option<Arc<InputObjectTypeDefinition>>
fn find_input_object_by_name( &self, key0: String ) -> Option<Arc<InputObjectTypeDefinition>>
Return an input object type definition corresponding to the name. Result of this query is not cached internally.
sourcefn types_definitions_by_name(&self) -> Arc<IndexMap<String, TypeDefinition>>
fn types_definitions_by_name(&self) -> Arc<IndexMap<String, TypeDefinition>>
Returns a map of type definitions in a GraphQL schema,
Where the key is the type name and the value is a TypeDefinition representing the type.
sourcefn find_type_definition_by_name(&self, key0: String) -> Option<TypeDefinition>
fn find_type_definition_by_name(&self, key0: String) -> Option<TypeDefinition>
Return a type definition corresponding to the name. Result of this query is not cached internally.
sourcefn query_operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>
fn query_operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>
Return all query operations in a corresponding file.
sourcefn mutation_operations(
&self,
key0: FileId
) -> Arc<Vec<Arc<OperationDefinition>>>
fn mutation_operations( &self, key0: FileId ) -> Arc<Vec<Arc<OperationDefinition>>>
Return all mutation operations in a corresponding file.
sourcefn subscription_operations(
&self,
key0: FileId
) -> Arc<Vec<Arc<OperationDefinition>>>
fn subscription_operations( &self, key0: FileId ) -> Arc<Vec<Arc<OperationDefinition>>>
Return all subscription operations in a corresponding file.
sourcefn operation_fields(&self, key0: SelectionSet) -> Arc<Vec<Field>>
fn operation_fields(&self, key0: SelectionSet) -> Arc<Vec<Field>>
Return the fields in a selection set, not including fragments.
sourcefn operation_inline_fragment_fields(
&self,
key0: SelectionSet
) -> Arc<Vec<Field>>
fn operation_inline_fragment_fields( &self, key0: SelectionSet ) -> Arc<Vec<Field>>
Return all operation inline fragment fields in a corresponding selection set.
sourcefn operation_fragment_spread_fields(
&self,
key0: SelectionSet
) -> Arc<Vec<Field>>
fn operation_fragment_spread_fields( &self, key0: SelectionSet ) -> Arc<Vec<Field>>
Return all operation fragment spread fields in a corresponding selection set.
sourcefn operation_fragment_references(
&self,
key0: SelectionSet
) -> Arc<Vec<Arc<FragmentDefinition>>>
fn operation_fragment_references( &self, key0: SelectionSet ) -> Arc<Vec<Arc<FragmentDefinition>>>
Return all fragment definitions referenced in the operation.
sourcefn flattened_operation_fields(&self, key0: SelectionSet) -> Vec<Arc<Field>>
fn flattened_operation_fields(&self, key0: SelectionSet) -> Vec<Arc<Field>>
Return the fields that selection_set selects including visiting fragments and inline fragments.
sourcefn selection_variables(&self, key0: SelectionSet) -> Arc<HashSet<Variable>>
fn selection_variables(&self, key0: SelectionSet) -> Arc<HashSet<Variable>>
Return all variables in a corresponding selection set.
sourcefn operation_definition_variables(
&self,
key0: Arc<Vec<VariableDefinition>>
) -> Arc<HashSet<Variable>>
fn operation_definition_variables( &self, key0: Arc<Vec<VariableDefinition>> ) -> Arc<HashSet<Variable>>
Return all variables in corresponding variable definitions.
sourcefn subtype_map(&self) -> Arc<HashMap<String, HashSet<String>>>
fn subtype_map(&self) -> Arc<HashMap<String, HashSet<String>>>
Return a subtype map of the current compiler’s type system.
Given the following schema,
type Query {
me: String
}
type Foo {
me: String
}
type Bar {
me: String
}
union UnionType = Foo | Bar
interface Baz {
me: String,
}
type ObjectType implements Baz { me: String }
interface InterfaceType implements Baz { me: String }
we can say that:
FooandBarare a subtypes ofUnionType.ObjectTypeandInterfaceTypeare subtypes ofBaz.
sourcefn is_subtype(&self, key0: String, key1: String) -> bool
fn is_subtype(&self, key0: String, key1: String) -> bool
Return true if the provided maybe_subtype is a subtype of the
corresponding abstract_type.
Given the following schema,
type Query {
me: String
}
type Foo {
me: String
}
type Bar {
me: String
}
union UnionType = Foo | Bar
interface Baz {
me: String,
}
type ObjectType implements Baz { me: String }
interface InterfaceType implements Baz { me: String }
we can say that:
db.is_subtype("UnionType".into(), "Foo".into()) // truedb.is_subtype("UnionType".into(), "Bar".into()) // truedb.is_subtype("Baz".into(), "ObjectType".into()) // truedb.is_subtype("Baz".into(), "InterfaceType".into()) // true