pub struct TermContext { /* private fields */ }Expand description
A managed DataFusion context for Term validation operations.
TermContext wraps DataFusion’s SessionContext and provides:
- Optimized default settings for data validation workloads
- Memory management with configurable limits
- Table registration helpers with tracking
- Automatic resource cleanup
§Examples
ⓘ
use term_guard::core::TermContext;
// Create context with default settings
let ctx = TermContext::new()?;
// Register a table
ctx.register_csv("users", "data/users.csv").await?;
// Use the underlying SessionContext for queries
let df = ctx.inner().sql("SELECT COUNT(*) FROM users").await?;Implementations§
Source§impl TermContext
impl TermContext
Sourcepub fn with_config(config: TermContextConfig) -> Result<Self>
pub fn with_config(config: TermContextConfig) -> Result<Self>
Sourcepub fn inner(&self) -> &SessionContext
pub fn inner(&self) -> &SessionContext
Returns a reference to the underlying DataFusion SessionContext.
This allows direct access to all DataFusion functionality while still benefiting from Term’s resource management.
§Examples
ⓘ
let df = ctx.inner().sql("SELECT * FROM data").await?;Sourcepub fn inner_mut(&mut self) -> &mut SessionContext
pub fn inner_mut(&mut self) -> &mut SessionContext
Returns a mutable reference to the underlying SessionContext.
Sourcepub fn config(&self) -> &TermContextConfig
pub fn config(&self) -> &TermContextConfig
Returns the configuration used to create this context.
Sourcepub fn registered_tables(&self) -> Vec<&str>
pub fn registered_tables(&self) -> Vec<&str>
Sourcepub fn deregister_table(&mut self, name: &str) -> Result<()>
pub fn deregister_table(&mut self, name: &str) -> Result<()>
Sourcepub async fn register_table_provider(
&mut self,
name: &str,
provider: Arc<dyn TableProvider>,
) -> Result<()>
pub async fn register_table_provider( &mut self, name: &str, provider: Arc<dyn TableProvider>, ) -> Result<()>
Trait Implementations§
Source§impl Drop for TermContext
Ensure proper cleanup when the context is dropped.
impl Drop for TermContext
Ensure proper cleanup when the context is dropped.
Auto Trait Implementations§
impl !RefUnwindSafe for TermContext
impl !UnwindSafe for TermContext
impl Freeze for TermContext
impl Send for TermContext
impl Sync for TermContext
impl Unpin for TermContext
impl UnsafeUnpin for TermContext
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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