pub struct WireClientFactory { /* private fields */ }Expand description
Connection factory for fraiseql-wire clients.
Since FraiseClient::query() consumes the client, we store the connection string
and create new clients on demand rather than pooling connections.
Implementations§
Source§impl WireClientFactory
impl WireClientFactory
Sourcepub fn new(connection_string: impl Into<String>) -> WireClientFactory
pub fn new(connection_string: impl Into<String>) -> WireClientFactory
Sourcepub async fn create_client(&self) -> Result<FraiseClient, FraiseQLError>
pub async fn create_client(&self) -> Result<FraiseClient, FraiseQLError>
Create a new fraiseql-wire client.
This method creates a fresh connection each time it’s called. The connection is closed when the client is dropped after query execution.
§Returns
A new FraiseClient ready for query execution.
§Errors
Returns FraiseQLError::ConnectionPool if connection fails.
§Example
ⓘ
use fraiseql_core::db::wire_pool::WireClientFactory;
let factory = WireClientFactory::new("postgres://localhost/fraiseql");
let client = factory.create_client().await?;Sourcepub fn connection_string(&self) -> &str
pub fn connection_string(&self) -> &str
Get the connection string.
Trait Implementations§
Source§impl Clone for WireClientFactory
impl Clone for WireClientFactory
Source§fn clone(&self) -> WireClientFactory
fn clone(&self) -> WireClientFactory
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WireClientFactory
impl RefUnwindSafe for WireClientFactory
impl Send for WireClientFactory
impl Sync for WireClientFactory
impl Unpin for WireClientFactory
impl UnsafeUnpin for WireClientFactory
impl UnwindSafe for WireClientFactory
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