MCPcopy Create free account
hub / github.com/acking-you/static_flow / upsert_articles

Function upsert_articles

crates/cli/src/db.rs:230–243  ·  view source on GitHub ↗
(table: &Table, records: &[ArticleRecord])

Source from the content-addressed store, hash-verified

228}
229
230pub async fn upsert_articles(table: &Table, records: &[ArticleRecord]) -> Result<()> {
231 if records.is_empty() {
232 return Ok(());
233 }
234 let batch = align_batch_to_table_schema(table, build_article_batch(records)?).await?;
235 let schema = batch.schema();
236 let batches = RecordBatchIterator::new(vec![Ok(batch)].into_iter(), schema);
237
238 let mut merge = table.merge_insert(&["id"]);
239 merge.when_matched_update_all(None);
240 merge.when_not_matched_insert_all();
241 merge.execute(Box::new(batches)).await?;
242 Ok(())
243}
244
245pub async fn upsert_images(table: &Table, records: &[ImageRecord]) -> Result<()> {
246 if records.is_empty() {

Callers 3

upsert_article_jsonFunction · 0.85
runFunction · 0.85
sync_notesFunction · 0.85

Calls 4

build_article_batchFunction · 0.85
executeMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected