pragma icon indicating copy to clipboard operation
pragma copied to clipboard

Custom events and custom queries

Open anasbarg opened this issue 4 years ago • 0 comments

Custom events and custom queries

Why

This will be a generic solution for developers to implement custom GraphQL operations, and custom events. Not "just" CRUD, though I believe that CRUD is enough for 99% of use cases.

Syntax

event <event_name> {
  on = <"REQUEST" | "STREAM" | "<model_name>.[<field_name>] <builtin_event>" | (imported_function: (dispatch: Dispatcher) => Unit)> # `imported_function` is a function that setups some stream and listens to it by dispatching events using `dispatcher`. Overtime we can implement some builtin functions for popular stuff like Reddis, RabbitMQ, etc. 
  [parser  = <imported_function: Request => Boolean>] # This is only required when `on == "REQUEST"`
  [request_handler = <imported_function: Request => Response>]
}

anasbarg avatar Nov 20 '20 10:11 anasbarg