Decorator

cask.router.Decorator
See theDecorator companion object
trait Decorator[OuterReturned, InnerReturned, Input] extends Annotation

A Decorator allows you to annotate a function to wrap it, via wrapFunction. You can use this to perform additional validation before or after the function runs, provide an additional parameter list of params, open/commit/rollback database transactions before/after the function runs, or even retrying the wrapped function if it fails.

Calls to the wrapped function are done on the delegate parameter passed to wrapFunction, which takes a Map representing any additional argument lists (if any).

Attributes

Companion:
object
Graph
Supertypes
class Annotation
class Object
trait Matchable
class Any
Known subtypes
trait Endpoint[OuterReturned, InnerReturned, Input]
class websocket
trait HttpEndpoint[InnerReturned, Input]
class delete
class get
class options
class patch
class post
class put
class route
class getJson
class postForm
class postJson

Members list

Concise view

Type members

Types

final type Delegate = Map[String, Input] => Result[InnerReturned]
type InputParser[T] <: ArgReader[Input, T, Request]
final type InputTypeAlias = Input

Value members

Abstract methods

def wrapFunction(ctx: Request, delegate: Delegate): Result[OuterReturned]

Concrete methods

def getParamParser[T](implicit p: InputParser[T]): InputParser[T]