Skip to main content

Query

Trait Query 

Source
pub trait Query:
    Send
    + Sync
    + Clone
    + Debug {
    type Result: Send + Sync + Clone;

    // Required methods
    fn query_id(&self) -> Uuid;
    fn validate(&self) -> Result<()>;
    fn cache_key(&self) -> Option<String>;
    fn timeout_ms(&self) -> Option<u64>;
}
Expand description

Base trait for all queries in the CQRS system

Required Associated Types§

Required Methods§

Source

fn query_id(&self) -> Uuid

Get the unique identifier for this query

Source

fn validate(&self) -> Result<()>

Validate the query before execution

Source

fn cache_key(&self) -> Option<String>

Get cache key for this query (if cacheable)

Source

fn timeout_ms(&self) -> Option<u64>

Get query timeout in milliseconds

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§