bunnydb-http
Async Rust client for Bunny.net Database SQL pipeline API.
Target endpoint format:
https://<db-id>.lite.bunnydb.net/v2/pipeline
Highlights
- Async API with
query,execute,batch - Positional (
?) and named (:name) parameters - Typed values:
null, integer, float, text, blob base64 - Structured error model: transport, HTTP, pipeline, decode
- Configurable timeout and retry/backoff for
429and5xx - Query telemetry fields (
rows_read,rows_written,query_duration_ms)
Installation
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "macros"] }
Quick Start
use ;
async
Authentication and Endpoint
BunnyDbClient::new_bearer(url, token): Pass only the token, crate sendsAuthorization: Bearer <token>.BunnyDbClient::new_raw_auth(url, authorization): Pass full authorization value directly.BunnyDbClient::new(url, token): Backward-compatible raw constructor.
url must point to the pipeline endpoint (.../v2/pipeline).
Parameters
Positional:
db.query.await?;
Named:
db.query
.await?;
Batch Semantics
batch returns per-statement outcomes and does not fail the full request for SQL-level statement errors.
use ;
let outcomes = db.batch.await?;
for outcome in outcomes
Timeout and Retry
use ;
let db = new_bearer.with_options;
Defaults:
timeout_ms = 10_000max_retries = 0retry_backoff_ms = 250
Error Model
BunnyDbError::Transport(reqwest::Error)BunnyDbError::Http { status, body }BunnyDbError::Pipeline { request_index, message, code }BunnyDbError::Decode(String)
Optional Features
tracing: retry/debug tracing hooksraw-mode: experimental raw response typesrow-map: experimental row mapping helpersbaton-experimental: experimental baton/session types
GUI Client (Example)
This repo includes a desktop GUI example built with eframe/egui.
Run it:
The GUI supports:
- Query / Execute / Batch modes
- Bearer or raw authorization mode
- JSON params:
[]for positional,{}for named - Batch JSON format:
Testing
Run all tests:
Live integration test reads credentials in this order:
- Environment:
BUNNYDB_PIPELINE_URLandBUNNYDB_TOKEN
MSRV
Rust 1.75
License
MIT