pub struct PostgresAdapter { /* private fields */ }Expand description
PostgreSQL adapter implementing the DatabaseProvider port
Implementations§
Source§impl PostgresAdapter
impl PostgresAdapter
Sourcepub fn new(host: String, port: u16, ssh_auth: AuthMethod) -> Self
pub fn new(host: String, port: u16, ssh_auth: AuthMethod) -> Self
Create a new PostgreSQL adapter
§Arguments
host- Database server hostname/IPport- PostgreSQL port (usually 5432)ssh_auth- SSH authentication method
Sourcepub fn from_env() -> PortResult<Self>
pub fn from_env() -> PortResult<Self>
Create adapter from environment variables
Reads:
POSTGRES_HOST- Database server hostname/IPPOSTGRES_PORT- PostgreSQL port (default: 5432)POSTGRES_SSH_USER- SSH username (default: “root”)POSTGRES_SSH_KEY- SSH private key path (default: ~/.ssh/id_rsa)
§Errors
Returns error if required environment variables are missing
Trait Implementations§
Source§impl DatabaseProvider for PostgresAdapter
impl DatabaseProvider for PostgresAdapter
Source§fn create_database<'life0, 'async_trait>(
&'life0 self,
request: DatabaseCreateRequest,
) -> Pin<Box<dyn Future<Output = PortResult<CreatedDatabase>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_database<'life0, 'async_trait>(
&'life0 self,
request: DatabaseCreateRequest,
) -> Pin<Box<dyn Future<Output = PortResult<CreatedDatabase>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new database Read more
Source§fn drop_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn drop_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop/delete a database Read more
Source§fn list_databases<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = PortResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_databases<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = PortResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all databases Read more
Source§fn database_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn database_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a database exists Read more
Source§fn create_user<'life0, 'async_trait>(
&'life0 self,
request: DatabaseUserRequest,
) -> Pin<Box<dyn Future<Output = PortResult<DatabaseUser>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_user<'life0, 'async_trait>(
&'life0 self,
request: DatabaseUserRequest,
) -> Pin<Box<dyn Future<Output = PortResult<DatabaseUser>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a database user Read more
Source§fn drop_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn drop_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop/delete a database user Read more
Source§fn grant_privileges<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
database: &'life1 str,
username: &'life2 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn grant_privileges<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
database: &'life1 str,
username: &'life2 str,
) -> Pin<Box<dyn Future<Output = PortResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Grant all privileges on a database to a user Read more
Auto Trait Implementations§
impl Freeze for PostgresAdapter
impl RefUnwindSafe for PostgresAdapter
impl Send for PostgresAdapter
impl Sync for PostgresAdapter
impl Unpin for PostgresAdapter
impl UnwindSafe for PostgresAdapter
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