pub struct DatabaseClient { /* private fields */ }Expand description
Database client for Sage agents.
Requires the database feature to be enabled.
Implementations§
Source§impl DatabaseClient
impl DatabaseClient
Sourcepub async fn connect(_url: &str) -> SageResult<Self>
pub async fn connect(_url: &str) -> SageResult<Self>
Create a new database client by connecting to the given URL.
Sourcepub async fn from_env() -> SageResult<Self>
pub async fn from_env() -> SageResult<Self>
Create a new database client from environment variables.
Sourcepub async fn query(&self, _sql: String) -> SageResult<Vec<DbRow>>
pub async fn query(&self, _sql: String) -> SageResult<Vec<DbRow>>
Execute a SQL query and return the results.
Sourcepub async fn execute(&self, _sql: String) -> SageResult<i64>
pub async fn execute(&self, _sql: String) -> SageResult<i64>
Execute a SQL statement and return affected row count.
Trait Implementations§
Source§impl Clone for DatabaseClient
impl Clone for DatabaseClient
Source§fn clone(&self) -> DatabaseClient
fn clone(&self) -> DatabaseClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DatabaseClient
impl RefUnwindSafe for DatabaseClient
impl Send for DatabaseClient
impl Sync for DatabaseClient
impl Unpin for DatabaseClient
impl UnsafeUnpin for DatabaseClient
impl UnwindSafe for DatabaseClient
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