Skip to main content

execute_query

Function execute_query 

Source
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:

  1. Starts the query execution on the actor system’s compute pool
  2. Applies a timeout to the operation
  3. Returns the query results or an appropriate error

§Arguments

  • system - The actor system to execute the query on
  • engine - The database engine to execute the query on
  • query - The RQL query string
  • identity - The identity context for permission checking
  • params - Query parameters
  • timeout - Maximum time to wait for query completion

§Returns

  • Ok(Vec<Frame>) - Query results on success
  • Err(ExecuteError::Timeout) - If the query exceeds the timeout
  • Err(ExecuteError::Cancelled) - If the query was cancelled
  • Err(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?;