pub struct LarkSpreadsheetLoader { /* private fields */ }Expand description
Load rows from a Feishu/Lark spreadsheet as Synaptic Documents.
Each non-header row becomes one document. The column designated by
[with_content_col] supplies the document content; all other columns
are stored in the document metadata.
§Example
use synaptic_lark::{LarkConfig, LarkSpreadsheetLoader};
use synaptic_core::Loader;
let loader = LarkSpreadsheetLoader::new(LarkConfig::new("cli_xxx", "secret"))
.with_token("shtcnXxx")
.with_sheet("0")
.with_content_col(0)
.with_header_row(true);
let docs = loader.load().await?;Implementations§
Source§impl LarkSpreadsheetLoader
impl LarkSpreadsheetLoader
Sourcepub fn new(config: LarkConfig) -> Self
pub fn new(config: LarkConfig) -> Self
Create a new loader using the given config.
Sourcepub fn with_token(self, t: impl Into<String>) -> Self
pub fn with_token(self, t: impl Into<String>) -> Self
Set the spreadsheet token (e.g. "shtcnXxx").
Sourcepub fn with_sheet(self, id: impl Into<String>) -> Self
pub fn with_sheet(self, id: impl Into<String>) -> Self
Set the sheet ID within the spreadsheet (default "0").
Sourcepub fn with_content_col(self, col: usize) -> Self
pub fn with_content_col(self, col: usize) -> Self
Set which column (0-indexed) to use as document content (default 0).
Sourcepub fn with_header_row(self, v: bool) -> Self
pub fn with_header_row(self, v: bool) -> Self
Whether the first row is a header row (default true).
Sourcepub fn spreadsheet_token(&self) -> &str
pub fn spreadsheet_token(&self) -> &str
Return the spreadsheet token (empty string if not set).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LarkSpreadsheetLoader
impl !RefUnwindSafe for LarkSpreadsheetLoader
impl Send for LarkSpreadsheetLoader
impl Sync for LarkSpreadsheetLoader
impl Unpin for LarkSpreadsheetLoader
impl UnsafeUnpin for LarkSpreadsheetLoader
impl !UnwindSafe for LarkSpreadsheetLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more