pragma
pragma copied to clipboard
Custom events and custom queries
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>]
}