Struct trustfall_core::schema::SchemaAdapter
source · pub struct SchemaAdapter<'a> { /* private fields */ }
Expand description
A Trustfall adapter for querying Trustfall schemas.
The schema matching this adapter is in the adjacent
schema.graphql
file,
and is also available via the SchemaAdapter::schema_text()
function.
Example
Create the adapter for querying a given schema like so:
let schema_text = include_str!("./schema.graphql");
let schema = Schema::parse(schema_text).expect("not a valid schema");
// Create an adapter that queries
// the schema in the local `schema.graphql` file.
let adapter = SchemaAdapter::new(&schema);
// Run queries using the adapter, etc.
Then you can query the contents of that schema. For example, the following query asks for all vertex properties and their types:
query {
VertexType {
name @output
property {
property_name: name @output
property_type: type @output
}
}
}
Implementations§
source§impl<'a> SchemaAdapter<'a>
impl<'a> SchemaAdapter<'a>
Trait Implementations§
source§impl<'a> Adapter<'a> for SchemaAdapter<'a>
impl<'a> Adapter<'a> for SchemaAdapter<'a>
source§fn resolve_starting_vertices(
&self,
edge_name: &Arc<str>,
_parameters: &EdgeParameters,
resolve_info: &ResolveInfo
) -> VertexIterator<'a, Self::Vertex>
fn resolve_starting_vertices( &self, edge_name: &Arc<str>, _parameters: &EdgeParameters, resolve_info: &ResolveInfo ) -> VertexIterator<'a, Self::Vertex>
Produce an iterator of vertices for the specified starting edge. Read more
source§fn resolve_property<V: AsVertex<Self::Vertex> + 'a>(
&self,
contexts: ContextIterator<'a, V>,
type_name: &Arc<str>,
property_name: &Arc<str>,
_resolve_info: &ResolveInfo
) -> ContextOutcomeIterator<'a, V, FieldValue>
fn resolve_property<V: AsVertex<Self::Vertex> + 'a>( &self, contexts: ContextIterator<'a, V>, type_name: &Arc<str>, property_name: &Arc<str>, _resolve_info: &ResolveInfo ) -> ContextOutcomeIterator<'a, V, FieldValue>
Resolve a property required by the query that’s being evaluated. Read more
source§fn resolve_neighbors<V: AsVertex<Self::Vertex> + 'a>(
&self,
contexts: ContextIterator<'a, V>,
type_name: &Arc<str>,
edge_name: &Arc<str>,
_parameters: &EdgeParameters,
resolve_info: &ResolveEdgeInfo
) -> ContextOutcomeIterator<'a, V, VertexIterator<'a, Self::Vertex>>
fn resolve_neighbors<V: AsVertex<Self::Vertex> + 'a>( &self, contexts: ContextIterator<'a, V>, type_name: &Arc<str>, edge_name: &Arc<str>, _parameters: &EdgeParameters, resolve_info: &ResolveEdgeInfo ) -> ContextOutcomeIterator<'a, V, VertexIterator<'a, Self::Vertex>>
Resolve the neighboring vertices across an edge. Read more
source§fn resolve_coercion<V: AsVertex<Self::Vertex> + 'a>(
&self,
contexts: ContextIterator<'a, V>,
type_name: &Arc<str>,
coerce_to_type: &Arc<str>,
resolve_info: &ResolveInfo
) -> ContextOutcomeIterator<'a, V, bool>
fn resolve_coercion<V: AsVertex<Self::Vertex> + 'a>( &self, contexts: ContextIterator<'a, V>, type_name: &Arc<str>, coerce_to_type: &Arc<str>, resolve_info: &ResolveInfo ) -> ContextOutcomeIterator<'a, V, bool>
Attempt to coerce vertices to a subtype, as required by the query that’s being evaluated. Read more
Auto Trait Implementations§
impl<'a> RefUnwindSafe for SchemaAdapter<'a>
impl<'a> Send for SchemaAdapter<'a>
impl<'a> Sync for SchemaAdapter<'a>
impl<'a> Unpin for SchemaAdapter<'a>
impl<'a> UnwindSafe for SchemaAdapter<'a>
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