Function headless_lms_models::library::user_exercise_state_updater::update_user_exercise_state_with_some_already_loaded_data
source · pub async fn update_user_exercise_state_with_some_already_loaded_data(
conn: &mut PgConnection,
user_exercise_state_id: Uuid,
already_loaded_internal_dependencies: UserExerciseStateUpdateAlreadyLoadedRequiredData
) -> ModelResult<UserExerciseState>
Expand description
Allows you to pass some data that update_user_exercise_state
fetches to avoid repeating SQL queries for performance. Note that the caller must be careful that it passes correct data to the function. A good rule of thumb is that this function expects unmodified data directly from the database.
Usage:
update_user_exercise_state_with_some_already_loaded_data(
conn,
user_exercise_state_id,
UserExerciseStateUpdateAlreadyLoadedRequiredData {
exercise: previously_loaded_exercise,
// Allows us to omit the data we have not manually loaded by setting `None` to all the other fields.
..Default::default()
},
)
.await?;