pub struct PgConnection { /* private fields */ }
Expand description
The connection string expected by PgConnection::establish
should be a PostgreSQL connection string, as documented at
https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING
Implementations§
Source§impl PgConnection
impl PgConnection
Sourcepub fn build_transaction(&self) -> TransactionBuilder<'_>
pub fn build_transaction(&self) -> TransactionBuilder<'_>
Build a transaction, specifying additional details such as isolation level
See TransactionBuilder
for more examples.
conn.build_transaction()
.read_only()
.serializable()
.deferrable()
.run(|| Ok(()))
Trait Implementations§
Source§impl Connection for PgConnection
impl Connection for PgConnection
Source§fn establish(database_url: &str) -> ConnectionResult<PgConnection>
fn establish(database_url: &str) -> ConnectionResult<PgConnection>
Establishes a new connection to the database Read more
Source§fn transaction<T, E, F>(&self, f: F) -> Result<T, E>
fn transaction<T, E, F>(&self, f: F) -> Result<T, E>
Executes the given function inside of a database transaction Read more
Source§fn begin_test_transaction(&self) -> QueryResult<()>
fn begin_test_transaction(&self) -> QueryResult<()>
Creates a transaction that will never be committed. This is useful for
tests. Panics if called while inside of a transaction.
Source§impl SimpleConnection for PgConnection
impl SimpleConnection for PgConnection
Source§fn batch_execute(&self, query: &str) -> QueryResult<()>
fn batch_execute(&self, query: &str) -> QueryResult<()>
Execute multiple SQL statements within the same string. Read more
Source§impl<Changes, Output> UpdateAndFetchResults<Changes, Output> for PgConnectionwhere
Changes: Copy + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Update<Changes, Changes>: LoadQuery<PgConnection, Output>,
impl<Changes, Output> UpdateAndFetchResults<Changes, Output> for PgConnectionwhere
Changes: Copy + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Update<Changes, Changes>: LoadQuery<PgConnection, Output>,
Source§fn update_and_fetch(&self, changeset: Changes) -> QueryResult<Output>
fn update_and_fetch(&self, changeset: Changes) -> QueryResult<Output>
See the traits documentation.
impl Send for PgConnection
Auto Trait Implementations§
impl !Freeze for PgConnection
impl !RefUnwindSafe for PgConnection
impl !Sync for PgConnection
impl Unpin for PgConnection
impl UnwindSafe for PgConnection
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