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§

source

fn type_system_definitions(&self) -> Arc<TypeSystemDefinitions>

Return all type system definitions defined in the compiler.

source

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.

source

fn extensions(&self) -> Arc<Vec<TypeExtension>>

Return all the extensions defined in the type system.

source

fn operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>

Return all the operations defined in a file.

source

fn fragments(&self, key0: FileId) -> ByName<FragmentDefinition>

Return all the fragments defined in a file.

source

fn all_operations(&self) -> Arc<Vec<Arc<OperationDefinition>>>

Return all the operations defined in any file.

source

fn all_fragments(&self) -> ByName<FragmentDefinition>

Return all the fragments defined in any file.

source

fn schema(&self) -> Arc<SchemaDefinition>

Return schema definition defined in the compiler.

source

fn object_types(&self) -> ByName<ObjectTypeDefinition>

Return all object type definitions defined in the compiler.

source

fn object_types_with_built_ins(&self) -> ByName<ObjectTypeDefinition>

Return all object type definitions, including instrospection types like __Schema, defined in the compiler.

source

fn scalars(&self) -> ByName<ScalarTypeDefinition>

Return all scalar type definitions defined in the compiler.

source

fn enums(&self) -> ByName<EnumTypeDefinition>

Return all enum type definitions defined in the compiler.

source

fn enums_with_built_ins(&self) -> ByName<EnumTypeDefinition>

Return all enums, including introspection types like __TypeKind, defined in the compiler.

source

fn unions(&self) -> ByName<UnionTypeDefinition>

Return all union type definitions defined in the compiler.

source

fn interfaces(&self) -> ByName<InterfaceTypeDefinition>

Return all interface type definitions defined in the compiler.

source

fn directive_definitions(&self) -> ByName<DirectiveDefinition>

Return all directive definitions defined in the compiler.

source

fn input_objects(&self) -> ByName<InputObjectTypeDefinition>

Return all input object type definitions defined in the compiler.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

fn find_types_with_directive(&self, key0: String) -> Arc<Vec<TypeDefinition>>

Return any type definitions that contain the corresponding directive

source

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.

source

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.

source

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.

source

fn query_operations(&self, key0: FileId) -> Arc<Vec<Arc<OperationDefinition>>>

Return all query operations in a corresponding file.

source

fn mutation_operations( &self, key0: FileId ) -> Arc<Vec<Arc<OperationDefinition>>>

Return all mutation operations in a corresponding file.

source

fn subscription_operations( &self, key0: FileId ) -> Arc<Vec<Arc<OperationDefinition>>>

Return all subscription operations in a corresponding file.

source

fn operation_fields(&self, key0: SelectionSet) -> Arc<Vec<Field>>

Return the fields in a selection set, not including fragments.

source

fn operation_inline_fragment_fields( &self, key0: SelectionSet ) -> Arc<Vec<Field>>

Return all operation inline fragment fields in a corresponding selection set.

source

fn operation_fragment_spread_fields( &self, key0: SelectionSet ) -> Arc<Vec<Field>>

Return all operation fragment spread fields in a corresponding selection set.

source

fn operation_fragment_references( &self, key0: SelectionSet ) -> Arc<Vec<Arc<FragmentDefinition>>>

Return all fragment definitions referenced in the operation.

source

fn flattened_operation_fields(&self, key0: SelectionSet) -> Vec<Arc<Field>>

Return the fields that selection_set selects including visiting fragments and inline fragments.

source

fn selection_variables(&self, key0: SelectionSet) -> Arc<HashSet<Variable>>

Return all variables in a corresponding selection set.

source

fn operation_definition_variables( &self, key0: Arc<Vec<VariableDefinition>> ) -> Arc<HashSet<Variable>>

Return all variables in corresponding variable definitions.

source

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:

  • Foo and Bar are a subtypes of UnionType.
  • ObjectType and InterfaceType are subtypes of Baz.
source

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()) // true
  • db.is_subtype("UnionType".into(), "Bar".into()) // true
  • db.is_subtype("Baz".into(), "ObjectType".into()) // true
  • db.is_subtype("Baz".into(), "InterfaceType".into()) // true

Trait Implementations§

source§

impl Upcast<dyn HirDatabase> for RootDatabase

source§

fn upcast(&self) -> &(dyn HirDatabase + 'static)

Implementors§

source§

impl<DB> HirDatabase for DBwhere DB: InputDatabase + AstDatabase + Database + HasQueryGroup<HirStorage>,