All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sangria.execution.SimpleAstBasedExtensionMiddleware.scala Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package sangria.execution

import sangria.ast

class SimpleAstBasedExtensionMiddleware[Ctx](extensionFn: MiddlewareQueryContext[Ctx, _, _] => ast.Value) extends Middleware[Ctx] with MiddlewareExtension[Ctx] {
  override type QueryVal = Unit

  override def beforeQuery(context: MiddlewareQueryContext[Ctx, _, _]) = ()
  override def afterQuery(queryVal: QueryVal, context: MiddlewareQueryContext[Ctx, _, _]) = ()

  def afterQueryExtensions(queryVal: QueryVal, context: MiddlewareQueryContext[Ctx, _, _]) = {
    import sangria.marshalling.queryAst._

    Vector(Extension(extensionFn(context)))
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy