pub struct CsvSource { /* private fields */ }Expand description
A CSV file data source with schema inference and compression support.
§Examples
ⓘ
use term_guard::sources::{CsvSource, CsvOptions};
// Simple CSV file
let source = CsvSource::new("data/users.csv")?;
// CSV with custom options
let options = CsvOptions {
delimiter: b'\t',
has_header: false,
..Default::default()
};
let source = CsvSource::with_options("data/users.tsv", options)?;
// Multiple files with glob pattern
let source = CsvSource::from_glob("data/*.csv")?;Implementations§
Source§impl CsvSource
impl CsvSource
Sourcepub fn new(path: impl Into<String>) -> Result<Self>
pub fn new(path: impl Into<String>) -> Result<Self>
Creates a new CSV source from a single file path.
Sourcepub fn with_options(
path: impl Into<String>,
options: CsvOptions,
) -> Result<Self>
pub fn with_options( path: impl Into<String>, options: CsvOptions, ) -> Result<Self>
Creates a new CSV source with custom options.
Sourcepub fn from_paths(paths: Vec<String>) -> Result<Self>
pub fn from_paths(paths: Vec<String>) -> Result<Self>
Creates a CSV source from multiple file paths.
Sourcepub async fn from_glob(pattern: impl Into<String>) -> Result<Self>
pub async fn from_glob(pattern: impl Into<String>) -> Result<Self>
Creates a CSV source from a glob pattern.
Sourcepub async fn from_globs(patterns: Vec<String>) -> Result<Self>
pub async fn from_globs(patterns: Vec<String>) -> Result<Self>
Creates a CSV source from multiple glob patterns.
Sourcepub fn with_custom_options(self, options: CsvOptions) -> Self
pub fn with_custom_options(self, options: CsvOptions) -> Self
Sets custom options for this CSV source.
Trait Implementations§
Source§impl DataSource for CsvSource
impl DataSource for CsvSource
Source§fn register_with_telemetry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table_name: &'life2 str,
telemetry: Option<&'life3 Arc<TermTelemetry>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn register_with_telemetry<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table_name: &'life2 str,
telemetry: Option<&'life3 Arc<TermTelemetry>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Registers this data source with telemetry support. Read more
Source§fn schema(&self) -> Option<&Arc<Schema>>
fn schema(&self) -> Option<&Arc<Schema>>
Returns the schema of this data source if known. Read more
Source§fn description(&self) -> String
fn description(&self) -> String
Returns a human-readable description of this data source.
Source§fn register<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn register<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Registers this data source with the given session context. Read more
Auto Trait Implementations§
impl Freeze for CsvSource
impl RefUnwindSafe for CsvSource
impl Send for CsvSource
impl Sync for CsvSource
impl Unpin for CsvSource
impl UnwindSafe for CsvSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more