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

Function build_published_comment_batch

crates/store/src/comments_store.rs:1064–1122  ·  view source on GitHub ↗
(record: &PublishedCommentRecord)

Source from the content-addressed store, hash-verified

1062}
1063
1064fn build_published_comment_batch(record: &PublishedCommentRecord) -> Result<RecordBatch> {
1065 let mut comment_id = StringBuilder::new();
1066 let mut task_id = StringBuilder::new();
1067 let mut article_id = StringBuilder::new();
1068 let mut author_name = StringBuilder::new();
1069 let mut author_avatar_seed = StringBuilder::new();
1070 let mut author_hash = StringBuilder::new();
1071 let mut comment_text = StringBuilder::new();
1072 let mut selected_text = StringBuilder::new();
1073 let mut anchor_block_id = StringBuilder::new();
1074 let mut anchor_context_before = StringBuilder::new();
1075 let mut anchor_context_after = StringBuilder::new();
1076 let mut reply_to_comment_id = StringBuilder::new();
1077 let mut reply_to_comment_text = StringBuilder::new();
1078 let mut reply_to_ai_reply_markdown = StringBuilder::new();
1079 let mut ai_reply_markdown = StringBuilder::new();
1080 let mut ip_region = StringBuilder::new();
1081 let mut published_at = TimestampMillisecondBuilder::new();
1082
1083 comment_id.append_value(&record.comment_id);
1084 task_id.append_value(&record.task_id);
1085 article_id.append_value(&record.article_id);
1086 author_name.append_value(&record.author_name);
1087 author_avatar_seed.append_value(&record.author_avatar_seed);
1088 author_hash.append_value(&record.author_hash);
1089 comment_text.append_value(&record.comment_text);
1090 selected_text.append_option(record.selected_text.as_deref());
1091 anchor_block_id.append_option(record.anchor_block_id.as_deref());
1092 anchor_context_before.append_option(record.anchor_context_before.as_deref());
1093 anchor_context_after.append_option(record.anchor_context_after.as_deref());
1094 reply_to_comment_id.append_option(record.reply_to_comment_id.as_deref());
1095 reply_to_comment_text.append_option(record.reply_to_comment_text.as_deref());
1096 reply_to_ai_reply_markdown.append_option(record.reply_to_ai_reply_markdown.as_deref());
1097 ai_reply_markdown.append_value(&record.ai_reply_markdown);
1098 ip_region.append_value(&record.ip_region);
1099 published_at.append_value(record.published_at);
1100
1101 let schema = comment_published_schema();
1102 let arrays: Vec<ArrayRef> = vec![
1103 Arc::new(comment_id.finish()),
1104 Arc::new(task_id.finish()),
1105 Arc::new(article_id.finish()),
1106 Arc::new(author_name.finish()),
1107 Arc::new(author_avatar_seed.finish()),
1108 Arc::new(author_hash.finish()),
1109 Arc::new(comment_text.finish()),
1110 Arc::new(selected_text.finish()),
1111 Arc::new(anchor_block_id.finish()),
1112 Arc::new(anchor_context_before.finish()),
1113 Arc::new(anchor_context_after.finish()),
1114 Arc::new(reply_to_comment_id.finish()),
1115 Arc::new(reply_to_comment_text.finish()),
1116 Arc::new(reply_to_ai_reply_markdown.finish()),
1117 Arc::new(ai_reply_markdown.finish()),
1118 Arc::new(ip_region.finish()),
1119 Arc::new(published_at.finish()),
1120 ];
1121 Ok(RecordBatch::try_new(schema, arrays)?)

Callers 1

Calls 1

comment_published_schemaFunction · 0.85

Tested by

no test coverage detected