Function select_all

Source
pub async fn select_all<T, F, R>(
    client: &Client,
    entity: T,
    to_model: F,
) -> Result<Vec<R>, Error>
where T: SqlQuery + SqlParams + Send + Sync + 'static, F: Fn(&Row) -> R + Send + Sync + 'static, R: Send + 'static,
Expand description

§select_all

Retrieves multiple records from the database using a custom transformation function. This is useful when you want to use a custom transformation function instead of the FromRow trait.

§Parameters

  • client: Database connection object
  • entity: Query parameter object (must implement SqlQuery and SqlParams traits)
  • to_model: Function to convert a Row object to the target object type

§Return Value

  • Result<Vec<R>, Error>: On success, returns the list of transformed objects; on failure, returns Error