Function fetch

Source
pub async fn fetch<P, R>(client: &Client, params: P) -> Result<R, Error>
where P: SqlQuery<R> + SqlParams + Send + Sync + 'static, R: FromRow + Send + Sync + 'static,
Expand description

§fetch

Retrieves a single record from the database and converts it to a struct.

§Parameters

  • client: Database connection object
  • params: Data object containing query parameters (must implement SqlQuery, FromRow, and SqlParams traits)

§Return Value

  • Result<T, Error>: On success, returns the retrieved record as a struct; on failure, returns Error