pub struct GraphqlExecutor { /* private fields */ }Expand description
Executes simplified GraphQL queries against an EntityStore.
§Usage
use std::sync::Arc;
use chainindex_core::entity::MemoryEntityStore;
use chainindex_core::graphql::GraphqlExecutor;
let store = Arc::new(MemoryEntityStore::new());
let executor = GraphqlExecutor::new(store);
let resp = executor.execute(r#"{ transfers(first: 5) { id } }"#).await;Implementations§
Source§impl GraphqlExecutor
impl GraphqlExecutor
Sourcepub fn new(store: Arc<dyn EntityStore>) -> Self
pub fn new(store: Arc<dyn EntityStore>) -> Self
Create a new executor backed by the given entity store.
Sourcepub fn register_schema(&self, entity_schema: EntitySchema)
pub fn register_schema(&self, entity_schema: EntitySchema)
Register an entity schema so the executor knows the field list.
Sourcepub fn introspect(&self) -> String
pub fn introspect(&self) -> String
Return the SDL for all registered entity types (introspection).
Sourcepub async fn execute(&self, query: &str) -> GraphqlResponse
pub async fn execute(&self, query: &str) -> GraphqlResponse
Execute a GraphQL query string and return a GraphqlResponse.
Auto Trait Implementations§
impl !Freeze for GraphqlExecutor
impl !RefUnwindSafe for GraphqlExecutor
impl Send for GraphqlExecutor
impl Sync for GraphqlExecutor
impl Unpin for GraphqlExecutor
impl UnsafeUnpin for GraphqlExecutor
impl !UnwindSafe for GraphqlExecutor
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