(db: &DbConn, breakpoints: HashMap<u32, usize>)
| 165 | } |
| 166 | |
| 167 | async fn inc_hit_count(db: &DbConn, breakpoints: HashMap<u32, usize>) -> Result<(), DbErr> { |
| 168 | // we batch the updates for all the breakpoints hit by N |
| 169 | let mut groups: HashMap<usize, Vec<u32>> = Default::default(); |
| 170 | for (bp_id, count) in breakpoints { |
| 171 | let entry = groups.entry(count).or_default(); |
| 172 | entry.push(bp_id); |
| 173 | } |
| 174 | |
| 175 | use breakpoint::Column::HitCount; |
| 176 | |
| 177 | for (count, bp_ids) in groups { |
| 178 | let mut update = Query::update(); |
| 179 | update |
| 180 | .table(Breakpoint) |
| 181 | .value(HitCount, Expr::col(HitCount).add(count as u32)) |
| 182 | .and_where(Expr::col(breakpoint::Column::Id).is_in(bp_ids)); |
| 183 | |
| 184 | let stmt = db.get_database_backend().build(&update); |
| 185 | log::debug!("{stmt}"); |
| 186 | db.execute(stmt).await?; |
| 187 | } |
| 188 | |
| 189 | Ok(()) |
| 190 | } |
| 191 | |
| 192 | async fn insert_functions(db: &DbConn, functions: HashSet<String>) -> Result<(), DbErr> { |
| 193 | use sea_orm::{sea_query::OnConflict, Set}; |
no test coverage detected