pub struct BunnyDbClient { /* private fields */ }Expand description
HTTP client for Bunny.net Database SQL pipeline endpoint.
Implementations§
Source§impl BunnyDbClient
impl BunnyDbClient
Sourcepub fn new(pipeline_url: impl Into<String>, token: impl Into<String>) -> Self
pub fn new(pipeline_url: impl Into<String>, token: impl Into<String>) -> Self
Creates a client with a raw authorization header value.
This is backward-compatible with previous versions where token
was passed directly as Authorization: <value>.
Sourcepub fn new_raw_auth(
pipeline_url: impl Into<String>,
authorization: impl Into<String>,
) -> Self
pub fn new_raw_auth( pipeline_url: impl Into<String>, authorization: impl Into<String>, ) -> Self
Creates a client with a full raw authorization value.
Example: "Bearer <token>" or any custom scheme.
Sourcepub fn new_bearer(
pipeline_url: impl Into<String>,
token: impl AsRef<str>,
) -> Self
pub fn new_bearer( pipeline_url: impl Into<String>, token: impl AsRef<str>, ) -> Self
Creates a client from a bearer token.
If the token is missing the Bearer prefix, it is added automatically.
Sourcepub fn with_options(self, opts: ClientOptions) -> Self
pub fn with_options(self, opts: ClientOptions) -> Self
Applies client options such as timeout and retry behavior.
Sourcepub async fn query<P: Into<Params>>(
&self,
sql: &str,
params: P,
) -> Result<QueryResult>
pub async fn query<P: Into<Params>>( &self, sql: &str, params: P, ) -> Result<QueryResult>
Executes a query statement and returns rows.
Sourcepub async fn execute<P: Into<Params>>(
&self,
sql: &str,
params: P,
) -> Result<ExecResult>
pub async fn execute<P: Into<Params>>( &self, sql: &str, params: P, ) -> Result<ExecResult>
Executes a statement and returns execution metadata.
Sourcepub async fn batch<I>(&self, statements: I) -> Result<Vec<StatementOutcome>>where
I: IntoIterator<Item = Statement>,
pub async fn batch<I>(&self, statements: I) -> Result<Vec<StatementOutcome>>where
I: IntoIterator<Item = Statement>,
Sends multiple statements in one pipeline request.
SQL errors at statement level are returned as
StatementOutcome::SqlError instead of failing the entire batch.
Trait Implementations§
Source§impl Clone for BunnyDbClient
impl Clone for BunnyDbClient
Source§fn clone(&self) -> BunnyDbClient
fn clone(&self) -> BunnyDbClient
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 BunnyDbClient
impl !RefUnwindSafe for BunnyDbClient
impl Send for BunnyDbClient
impl Sync for BunnyDbClient
impl Unpin for BunnyDbClient
impl UnsafeUnpin for BunnyDbClient
impl !UnwindSafe for BunnyDbClient
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