pub struct PostgresqlBackend { /* private fields */ }Expand description
PostgreSQL storage backend
This backend uses OpenDAL’s Postgresql service to query database tables. Each row is treated as a “file” where:
- The key_field column becomes the file path
- The value_field column becomes the file content
§Example
ⓘ
use sqlite_vtable_opendal::backends::postgresql::PostgresqlBackend;
use sqlite_vtable_opendal::types::QueryConfig;
let backend = PostgresqlBackend::new(
"postgresql://user:pass@localhost/db",
"my_table",
"id",
"data"
);
let config = QueryConfig::default();
let files = backend.list_files(&config).await?;Implementations§
Source§impl PostgresqlBackend
impl PostgresqlBackend
Sourcepub fn new(
connection_string: impl Into<String>,
table: impl Into<String>,
key_field: impl Into<String>,
value_field: impl Into<String>,
) -> Self
pub fn new( connection_string: impl Into<String>, table: impl Into<String>, key_field: impl Into<String>, value_field: impl Into<String>, ) -> Self
Create a new PostgreSQL backend
§Arguments
connection_string- PostgreSQL connection stringtable- Table name to querykey_field- Column name for keys (default: “key”)value_field- Column name for values (default: “value”)
§Example
use sqlite_vtable_opendal::backends::postgresql::PostgresqlBackend;
let backend = PostgresqlBackend::new(
"postgresql://localhost/mydb",
"documents",
"id",
"content"
);Trait Implementations§
Source§impl StorageBackend for PostgresqlBackend
impl StorageBackend for PostgresqlBackend
Source§fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 QueryConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 QueryConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileMetadata>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files from the storage backend according to the query configuration Read more
Source§fn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Get the name of this backend (for logging/debugging)
Auto Trait Implementations§
impl Freeze for PostgresqlBackend
impl RefUnwindSafe for PostgresqlBackend
impl Send for PostgresqlBackend
impl Sync for PostgresqlBackend
impl Unpin for PostgresqlBackend
impl UnsafeUnpin for PostgresqlBackend
impl UnwindSafe for PostgresqlBackend
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
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