pub async fn execute_query(
system: ActorSystem,
engine: StandardEngine,
query: String,
identity: IdentityId,
params: Params,
timeout: Duration,
) -> ExecuteResult<Vec<Frame>>Expand description
Execute a query with timeout.
This function:
- Starts the query execution on the actor system’s compute pool
- Applies a timeout to the operation
- Returns the query results or an appropriate error
§Arguments
system- The actor system to execute the query onengine- The database engine to execute the query onquery- The RQL query stringidentity- The identity context for permission checkingparams- Query parameterstimeout- Maximum time to wait for query completion
§Returns
Ok(Vec<Frame>)- Query results on successErr(ExecuteError::Timeout)- If the query exceeds the timeoutErr(ExecuteError::Cancelled)- If the query was cancelledErr(ExecuteError::Engine)- If the engine returns an error
§Example
ⓘ
let result = execute_query(
system,
engine,
"FROM users take 42".to_string(),
identity,
Params::None,
Duration::from_secs(30),
).await?;