Struct warpgrapher::engine::Engine [−][src]
A Warpgrapher GraphQL engine.
The Engine
struct Juniper GraphQL service on top of it, with an auto-generated set of
resolvers that cover basic CRUD operations, and potentially custom resolvers, on a set of
data types and the relationships between them. The engine includes handling of back-end
communications with the chosen databse.
Examples
let config = Configuration::default(); let mut engine = Engine::<()>::new(config, NoDatabasePool {}).build()?;
Implementations
impl<RequestCtx> Engine<RequestCtx> where
RequestCtx: RequestContext,
[src]
RequestCtx: RequestContext,
pub fn new(
config: Configuration,
database_pool: <<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType
) -> EngineBuilder<RequestCtx>
[src]
config: Configuration,
database_pool: <<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType
) -> EngineBuilder<RequestCtx>
Creates a new EngineBuilder
. Requiered arguments are a Configuration
, the
deserialized configuration for a Warpgrapher engine, which contains definitions of types
and endpoints, as well as a DatabasePool
, which tells the ending how to connect with a
back-end graph storage engine.
Examples
let config = Configuration::default(); let mut engine = Engine::<()>::new(config, NoDatabasePool {}).build()?;
pub async fn execute(
&self,
query: String,
input: Option<Value>,
metadata: HashMap<String, String>
) -> Result<Value, Error>
[src]
&self,
query: String,
input: Option<Value>,
metadata: HashMap<String, String>
) -> Result<Value, Error>
Executes a GraphQLRequest
, returning a serialized JSON response.
Errors
Returns an Error
variant ExtensionFailed
if a pre request hook or post request
hook extension returns an error.
Returns an Error
variant SerializationFailed
if the engine response cannot be
serialized successfully.
Examples
let config = Configuration::default(); let mut engine = Engine::<()>::new(config, NoDatabasePool {}).build()?; let query = "query { name }".to_string(); let metadata: HashMap<String, String> = HashMap::new(); let result = engine.execute(query, None, metadata).await?;
Trait Implementations
impl<RequestCtx: Clone> Clone for Engine<RequestCtx> where
RequestCtx: RequestContext,
[src]
RequestCtx: RequestContext,
impl<RequestCtx> Debug for Engine<RequestCtx> where
RequestCtx: RequestContext,
[src]
RequestCtx: RequestContext,
impl<RequestCtx> Display for Engine<RequestCtx> where
RequestCtx: RequestContext,
[src]
RequestCtx: RequestContext,
Auto Trait Implementations
impl<RequestCtx> RefUnwindSafe for Engine<RequestCtx> where
RequestCtx: RefUnwindSafe,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: RefUnwindSafe,
RequestCtx: RefUnwindSafe,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: RefUnwindSafe,
impl<RequestCtx> Send for Engine<RequestCtx>
impl<RequestCtx> Sync for Engine<RequestCtx>
impl<RequestCtx> Unpin for Engine<RequestCtx> where
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: Unpin,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: Unpin,
impl<RequestCtx> UnwindSafe for Engine<RequestCtx> where
RequestCtx: RefUnwindSafe,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: UnwindSafe,
RequestCtx: RefUnwindSafe,
<<RequestCtx as RequestContext>::DBEndpointType as DatabaseEndpoint>::PoolType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,