pub fn register(
conn: &Connection,
module_name: &str,
connection_string: impl Into<String>,
table: impl Into<String>,
key_field: impl Into<String>,
value_field: impl Into<String>,
) -> Result<()>Expand description
Register the postgresql virtual table with SQLite
This function creates a virtual table module that allows querying PostgreSQL database tables using SQL.
§Arguments
conn- SQLite connectionmodule_name- Name for the virtual table (e.g., “pg_data”)connection_string- PostgreSQL connection stringtable- Table name to querykey_field- Column name for keysvalue_field- Column name for values
§Example
ⓘ
use rusqlite::Connection;
use sqlite_vtable_opendal::backends::postgresql;
let conn = Connection::open_in_memory()?;
postgresql::register(
&conn,
"pg_data",
"postgresql://localhost/mydb",
"documents",
"id",
"content"
)?;
// Now you can query: SELECT * FROM pg_data