pub type BeforeQueryEventFunc<RequestCtx> = fn(_: Option<Value>, _: EventFacade<'_, RequestCtx>) -> BoxFuture<'_, Result<Option<Value>, Error>>;
Expand description

Type alias for a function called before an event. The Value returned by this function will be used as the input to the next before event function, or to the base Warpgrapher CRUD resolver if there are no more before event functions.

The structure of Value is <Type>QueryInput.

You can refer to the generated GraphQL schema documentation for the data structures.

Examples


fn before_user_read(value: Option<Value>, ef: EventFacade<()>) -> BoxFuture<Result<Option<Value>, Error>> {
    Box::pin(async move {
       // Normally work would be done here, resulting in some new value.
       Ok(value)
    })
}

let f: Box<BeforeQueryEventFunc<()>> = Box::new(before_user_read);