MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / inc_hit_count

Function inc_hit_count

indexer/src/database.rs:167–190  ·  view source on GitHub ↗
(db: &DbConn, breakpoints: HashMap<u32, usize>)

Source from the content-addressed store, hash-verified

165}
166
167async 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
192async fn insert_functions(db: &DbConn, functions: HashSet<String>) -> Result<(), DbErr> {
193 use sea_orm::{sea_query::OnConflict, Set};

Callers 1

insert_eventsFunction · 0.85

Calls 3

addMethod · 0.80
buildMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected