pjson_rs/application/handlers/mod.rs
1//! Command and Query handlers implementing CQRS pattern
2
3pub mod command_handlers;
4pub mod query_handlers;
5
6use crate::application::ApplicationResult;
7use async_trait::async_trait;
8
9/// Generic command handler trait
10#[async_trait]
11pub trait CommandHandler<TCommand, TResponse> {
12 async fn handle(&self, command: TCommand) -> ApplicationResult<TResponse>;
13}
14
15/// Generic query handler trait
16#[async_trait]
17pub trait QueryHandler<TQuery, TResponse> {
18 async fn handle(&self, query: TQuery) -> ApplicationResult<TResponse>;
19}