#[sqlite3_ext_vtab]Expand description
Declare a virtual table module.
This attribute is intended to be applied to the struct which implements VTab and related traits. The first parameter to the attribute is the type of module to create, which is one of StandardModule, EponymousModule, EponymousOnlyModule. The subsequent parameters refer to traits in sqlite3_ext::vtab, and describe the functionality which the virtual table supports. See the corresponding structs and traits in sqlite3_ext::vtab for more details.
The resulting struct will have an associated method module which returns the concrete
type of module specified in the first parameter, or a Result containing it.
ยงExamples
Declare a table-valued function:
use sqlite3_ext::*;
#[sqlite3_ext_vtab(EponymousModule)]
struct MyTableFunction {}
#[sqlite3_ext_main]
fn init(db: &Connection) -> Result<()> {
db.create_module("my_table_function", MyTableFunction::module(), ())?;
Ok(())
}Declare a standard virtual table that supports updates:
use sqlite3_ext::*;
#[sqlite3_ext_vtab(StandardModule, UpdateVTab)]
struct MyTable {}
#[sqlite3_ext_main]
fn init(db: &Connection) -> Result<()> {
db.create_module("my_table", MyTable::module(), ())?;
Ok(())
}Declare an eponymous-only table that supports updates:
use sqlite3_ext::*;
#[sqlite3_ext_vtab(EponymousOnlyModule, UpdateVTab)]
struct MyTable {}
#[sqlite3_ext_main]
fn init(db: &Connection) -> Result<()> {
db.create_module("my_table", MyTable::module()?, ())?;
Ok(())
}