Skip to main content

LarkBitableLoader

Struct LarkBitableLoader 

Source
pub struct LarkBitableLoader { /* private fields */ }
Expand description

Load Feishu/Lark Bitable records into Synaptic Documents for RAG pipelines.

Each Bitable record becomes one Document. The content field is populated from the field named by [with_content_field], or the first string-typed field when no explicit field is given. All other fields are stored in metadata.

§Example

use synaptic_lark::{LarkConfig, LarkBitableLoader};
use synaptic_core::Loader;

let config = LarkConfig::new("cli_xxx", "secret_xxx");
let loader = LarkBitableLoader::new(config)
    .with_app("bascnAbcXxx")
    .with_table("tblXxx")
    .with_content_field("Description");

let docs = loader.load().await?;
for doc in &docs {
    println!("Record: {}", doc.id);
    println!("Content: {}", doc.content);
}

Implementations§

Source§

impl LarkBitableLoader

Source

pub fn new(config: LarkConfig) -> Self

Create a new loader using the given config.

Source

pub fn with_app(self, app_token: impl Into<String>) -> Self

Set the Bitable app token (e.g. "bascnAbcXxx").

Source

pub fn with_table(self, table_id: impl Into<String>) -> Self

Set the table ID within the Bitable app (e.g. "tblXxx").

Source

pub fn with_view(self, view_id: impl Into<String>) -> Self

Optionally filter records by a specific view (e.g. "vewXxx").

Source

pub fn with_content_field(self, field: impl Into<String>) -> Self

Specify which field’s value becomes the Document.content.

When not set, the first string-typed field is used automatically.

Source

pub fn app_token(&self) -> &str

Returns the configured app token, or "" if not set.

Source

pub fn table_id(&self) -> &str

Returns the configured table ID, or "" if not set.

Source

pub fn view_id(&self) -> Option<&str>

Returns the configured view ID if any.

Source

pub fn content_field(&self) -> Option<&str>

Returns the configured content field name if any.

Trait Implementations§

Source§

impl Loader for LarkBitableLoader

Source§

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all documents from this source.
Source§

fn lazy_load( &self, ) -> Pin<Box<dyn Stream<Item = Result<Document, SynapticError>> + Send + '_>>

Stream documents lazily. Default implementation wraps load().

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more