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 (implementingToDbValue).
§Returns
- Success: Collection of deserialized results.
- Failure:
DatabaseErrororSerializationError.
§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
Tmust implementDeserializeOwned(lifetimes are not required).