Skip to main content

PostgresClient

Struct PostgresClient 

Source
pub struct PostgresClient<F: ConnectionFactory> { /* private fields */ }

Implementations§

Source§

impl<F: ConnectionFactory> PostgresClient<F>

Source

pub async fn copy_out( &mut self, query: &(impl Statement + ?Sized), parameters: &[&dyn ToSql], ) -> Result<CopyReader<'_, F>, ElefantClientError>

Source

pub async fn copy_in( &mut self, query: &(impl Statement + ?Sized), parameters: &[&dyn ToSql], ) -> Result<CopyWriter<'_, F>, ElefantClientError>

Source§

impl<F: ConnectionFactory> PostgresClient<F>

Source

pub async fn execute_non_query<S>( &mut self, query: &S, parameters: &[&dyn ToSql], ) -> Result<(), ElefantClientError>
where S: Statement + ?Sized,

Execute a non-query statement using binary mode (with prepared statements)

Source

pub async fn execute_non_query_simple( &mut self, query: &str, ) -> Result<(), ElefantClientError>

Execute a non-query statement using simple query mode (text format, no parameters)

Source§

impl<F: ConnectionFactory> PostgresClient<F>

Source

pub async fn query( &mut self, query: &(impl Statement + ?Sized), parameters: &[&dyn ToSql], ) -> Result<QueryResult<'_, F>, ElefantClientError>

Execute a query in binary mode - always uses prepared statements

Source

pub async fn query_simple( &mut self, query: &str, ) -> Result<SimpleQueryResult<'_, F>, ElefantClientError>

Execute a simple query in text mode - only accepts &str, no parameters

Source

pub async fn prepare_query( &mut self, query: &str, ) -> Result<PreparedQuery, ElefantClientError>

Source§

impl<F: ConnectionFactory> PostgresClient<F>

Source

pub async fn create_replication_slot( &mut self, slot_name: &str, output_plugin: &str, ) -> Result<(String, Lsn), ElefantClientError>

Source

pub async fn drop_replication_slot( &mut self, slot_name: &str, ) -> Result<(), ElefantClientError>

Source

pub async fn start_replication( &mut self, slot_name: &str, lsn: Lsn, options: &str, ) -> Result<ReplicationStream<'_, F>, ElefantClientError>

Source§

impl<F: ConnectionFactory> PostgresClient<F>

Source

pub async fn reset(&mut self) -> Result<(), ElefantClientError>

Source

pub fn get_parameter(&self, name: &str) -> Option<&str>

Get a server parameter received via ParameterStatus messages.

PostgreSQL sends these during connection startup and whenever a session parameter changes. Common parameters include server_version, server_encoding, TimeZone, etc.

Source

pub async fn close(self) -> Result<(), ElefantClientError>

Gracefully close this connection by sending a Terminate message to the backend and a TLS close_notify (if applicable). Consumes the client so it cannot be used afterward.

Auto Trait Implementations§

§

impl<F> Freeze for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: Freeze, Option<PostgresPool<F>>: Freeze,

§

impl<F> RefUnwindSafe for PostgresClient<F>

§

impl<F> Send for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: Send, Option<PostgresPool<F>>: Send,

§

impl<F> Sync for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: Sync, Option<PostgresPool<F>>: Sync,

§

impl<F> Unpin for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: Unpin, Option<PostgresPool<F>>: Unpin,

§

impl<F> UnsafeUnpin for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: UnsafeUnpin, Option<PostgresPool<F>>: UnsafeUnpin,

§

impl<F> UnwindSafe for PostgresClient<F>
where PostgresConnection<<F as ConnectionFactory>::Connection>: UnwindSafe, Option<PostgresPool<F>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more