Flush the pending batch, returning it if non-empty.
(&mut self)
| 296 | |
| 297 | /// Flush the pending batch, returning it if non-empty. |
| 298 | pub fn flush(&mut self) -> Option<TriggerBatch> { |
| 299 | self.pending.take().and_then(|p| { |
| 300 | if p.rows.is_empty() { |
| 301 | None |
| 302 | } else { |
| 303 | Some(TriggerBatch { |
| 304 | collection: p.collection, |
| 305 | operation: p.operation, |
| 306 | rows: p.rows, |
| 307 | tenant_id: p.tenant_id, |
| 308 | }) |
| 309 | } |
| 310 | }) |
| 311 | } |
| 312 | |
| 313 | /// Check if there is a pending batch with rows. |
| 314 | pub fn has_pending(&self) -> bool { |