pub struct PgConn {
pub(crate) conn: *mut PGconn,
}Fields§
§conn: *mut PGconnImplementations§
Source§impl PgConn
impl PgConn
Sourcepub fn connect_db_env_vars() -> Result<PgConn, NulError>
pub fn connect_db_env_vars() -> Result<PgConn, NulError>
Connect to the database using environment variables.
See the official doc.
pub fn connect_db(s: &str) -> Result<PgConn, NulError>
pub fn status(&self) -> ConnStatusType
pub fn exec(&self, query: &str) -> Result<PgResult, NulError>
pub fn exec_file(&self, file_path: &str) -> Result<PgResult, NulError>
pub fn trace(&mut self, file: &str)
pub fn untrace(&mut self)
pub fn socket(&self) -> PgSocket
pub fn consume_input(&mut self) -> Result<(), String>
pub fn notifies(&mut self) -> Option<PgNotify>
pub fn error_message(&self) -> String
Sourcepub(crate) extern "C" fn ffi_notice_processor<F>(
arg: *mut c_void,
data: *const c_char,
)
pub(crate) extern "C" fn ffi_notice_processor<F>( arg: *mut c_void, data: *const c_char, )
A callback function to receive notices from the server. https://stackoverflow.com/questions/24191249/working-with-c-void-in-an-ffi https://adventures.michaelfbryan.com/posts/rust-closures-in-ffi/
pub fn set_notice_processor<F>(&mut self, proc: F) -> Box<F>
pub(crate) extern "C" fn ffi_notice_receiver<F>( arg: *mut c_void, data: *const PGresult, )
Sourcepub fn set_notice_receiver<F>(&mut self, proc: F) -> Box<F>
pub fn set_notice_receiver<F>(&mut self, proc: F) -> Box<F>
Sets a notice receiver function to receive notices from the server. Notices are sent to the receiver after command execution is completed. https://www.postgresql.org/docs/current/libpq-notice-processing.html
pub fn listen<F, T>(&mut self, timeout_sec: Option<f64>, proc: F) -> Vec<T>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PgConn
impl RefUnwindSafe for PgConn
impl Unpin for PgConn
impl UnwindSafe for PgConn
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