Skip to main content

VtabModuleFactory

Trait VtabModuleFactory 

Source
pub trait VtabModuleFactory: Send + Sync {
    // Required method
    fn create(
        &self,
        cx: &Cx,
        args: &[&str],
    ) -> Result<Box<dyn ErasedVtabInstance>>;

    // Provided methods
    fn connect(
        &self,
        cx: &Cx,
        args: &[&str],
    ) -> Result<Box<dyn ErasedVtabInstance>> { ... }
    fn column_info(&self, _args: &[&str]) -> Vec<(String, char)> { ... }
}
Expand description

A type-erased virtual table module factory.

Registered with the connection via register_module("name", factory). When CREATE VIRTUAL TABLE ... USING name(args) is executed, the factory’s create method is called to produce a concrete vtab instance.

Required Methods§

Source

fn create(&self, cx: &Cx, args: &[&str]) -> Result<Box<dyn ErasedVtabInstance>>

Create a new virtual table instance for CREATE VIRTUAL TABLE.

Provided Methods§

Source

fn connect(&self, cx: &Cx, args: &[&str]) -> Result<Box<dyn ErasedVtabInstance>>

Connect to an existing virtual table (subsequent opens).

Source

fn column_info(&self, _args: &[&str]) -> Vec<(String, char)>

Column names and affinities for the virtual table schema.

Implementors§