Function fetch

Source
pub async fn fetch<T>(client: &Client, params: T) -> Result<T, Error>
where T: SqlQuery + FromRow + SqlParams + 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