pub fn update_worker_vel(
    conn: &PgConnection,
    vel: Velocity,
    id: i32,
    _logger: &Logger,
) -> Result<usize, MeshSimError> {
    use schema::worker_velocities::{self, *};

    let new_vel = NewVel {
        worker_id: id,
        x: vel.x,
        y: vel.y,
    };
    let rows = diesel::insert_into(worker_velocities::table)
        .values(&new_vel)
        .on_conflict(worker_id)
        .do_update()
        .set(&new_vel)
        .execute(conn)
        .map_err(|e| {
            let error_msg = String::from("Failed to insert/update worker velocity");
            MeshSimError {
                kind: MeshSimErrorKind::SQLExecutionFailure(error_msg),
                cause: Some(Box::new(e)),
            }
        })?;
    Ok(rows)
}
/// Updates the worker's velocity
Updates the worker's velocity
Updates the worker ' s velocity
pub fn update_worker_vel(
    conn: &PgConnection,
    vel: Velocity,
    id: i32,
    _logger: &Logger,
) -> Result<usize, MeshSimError> {
    use schema::worker_velocities::{self, *};
    let new_vel = NewVel {
        worker_id: id,
        x: vel.x,
        y: vel.y,
    };
    let rows = diesel::insert_into(worker_velocities::table)
        .values(&new_vel)
        .on_conflict(worker_id)
        .do_update()
        .set(&new_vel)
        .execute(conn)
        .map_err(|e| {
            let error_msg = String::from("Failed to insert/update worker velocity");
            MeshSimError {
                kind: MeshSimErrorKind::SQLExecutionFailure(error_msg),
                cause: Some(Box::new(e)),
            }
        })?;
    Ok(rows)
}
pub fn update_worker_vel ( conn : & PgConnection , vel : Velocity , id : i32 , _logger : & Logger , ) -> Result < usize , MeshSimError > { use schema :: worker_velocities :: { self , * } ; let new_vel = NewVel { worker_id : id , x : vel . x , y : vel . y , } ; let rows = diesel :: insert_into ( worker_velocities :: table ) . values ( & new_vel ) . on_conflict ( worker_id ) . do_update ( ) . set ( & new_vel ) . execute ( conn ) . map_err ( | e | { let error_msg = String :: from ( " " ) ; MeshSimError { kind : MeshSimErrorKind :: SQLExecutionFailure ( error_msg ) , cause : Some ( Box :: new ( e ) ) , } } ) ? ; Ok ( rows ) }
Updates the worker's velocity
Updates the worker ' s velocity
conn
&PgConnection
vel
Velocity
id
i32
_logger
&Logger