pub trait VirtualTableFactory:
Send
+ Sync
+ 'static {
// Required methods
fn create_boxed(&self) -> Box<dyn TableVirtual<'static> + Send + Sync>;
fn definition(&self) -> Arc<TableVirtualDef>;
}Expand description
Factory for creating virtual table instances.
Implementations must be thread-safe and create fresh instances on each call. The factory pattern allows virtual tables to be registered once and instantiated on-demand for each query execution.
§Example
ⓘ
struct MyTableFactory {
definition: Arc<TableVirtualDef>,
}
impl VirtualTableFactory for MyTableFactory {
fn create_boxed(&self) -> Box<dyn TableVirtual<'static> + Send + Sync> {
Box::new(MyVirtualTable::new(self.definition.clone()))
}
fn definition(&self) -> Arc<TableVirtualDef> {
self.definition.clone()
}
}Required Methods§
Sourcefn create_boxed(&self) -> Box<dyn TableVirtual<'static> + Send + Sync>
fn create_boxed(&self) -> Box<dyn TableVirtual<'static> + Send + Sync>
Create a new virtual table instance.
Each call should return a fresh instance ready to process a new query.
The returned instance must implement TableVirtual<'a> for all lifetimes.
Sourcefn definition(&self) -> Arc<TableVirtualDef>
fn definition(&self) -> Arc<TableVirtualDef>
Get the table definition (schema).
Returns the metadata including column names, types, and constraints.