query

Function query 

Source
pub fn query<T: DeserializeOwned>(
    sql: &str,
    params: &[&dyn ToDbValue],
) -> VtxResult<Vec<T>>
Expand description

Executes query SQL statements (SELECT) and deserializes the result into a list of target types.

§Parameters

  • sql: SQL string (supports ? placeholders).
  • params: Array of parameters (implementing ToDbValue).

§Returns

  • Success: Collection of deserialized results.
  • Failure: DatabaseError or SerializationError.

§Notes

  • The host interface returns a JSON string.
  • To ensure performance, it is recommended to limit a single response to within 1MB (pagination via LIMIT is suggested).
  • Generic T must implement DeserializeOwned (lifetimes are not required).