pub async fn update_build(
pool: &Pool<MySql>,
id: i64,
status: &str,
build_log: &str,
) -> Result<Build>
Expand description
Updates an existing build record with new status and log information.
This function modifies a build record to reflect the current state of the build process. It’s typically called during or after a build process to update its status and append to the build log.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the build to updatestatus
- New status of the build (e.g., “success”, “failed”, “in_progress”)build_log
- Updated build log content
§Returns
Ok(Build)
- Successfully updated build recordErr(anyhow::Error)
- Failed to update build
§Use Cases
Common use cases for this function include:
- Updating build status as it progresses through different stages
- Appending build output to the log as it becomes available
- Marking a build as complete with its final status
§Note
This function replaces the entire build log content rather than appending to it. If incremental updates are needed, the caller should fetch the current log, append to it, and then pass the complete updated log to this function.