pub trait ForgeQuery:
Send
+ Sync
+ 'static {
type Args: DeserializeOwned + Serialize + Send + Sync;
type Output: Serialize + Send;
// Required methods
fn info() -> FunctionInfo;
fn execute(
ctx: &QueryContext,
args: Self::Args,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + '_>>;
}Expand description
A query function (read-only, cacheable, subscribable).
Queries:
- Can only read from the database
- Are automatically cached based on arguments
- Can be subscribed to for real-time updates
- Should be deterministic (same inputs → same outputs)
- Should not have side effects
Required Associated Types§
Required Methods§
Sourcefn info() -> FunctionInfo
fn info() -> FunctionInfo
Function metadata.
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.