Expand description
Async HTTP client for Bunny.net Database SQL pipeline API.
This crate wraps the /v2/pipeline endpoint with ergonomic methods:
§Client Construction
Choose the constructor that fits your deployment:
| Constructor | When to use |
|---|---|
BunnyDbClient::from_env | 12-factor / container: BUNNYDB_PIPELINE_URL + BUNNYDB_TOKEN |
BunnyDbClient::from_env_db_id | Edge scripts / containers: BUNNYDB_ID + BUNNYDB_TOKEN |
BunnyDbClient::from_db_id | Hardcoded DB ID, token from config |
BunnyDbClient::new_bearer | Full URL + bearer token |
BunnyDbClient::new_raw_auth | Full URL + custom auth header |
§Quick Start — environment variables
use bunnydb_http::BunnyDbClient;
// Reads BUNNYDB_PIPELINE_URL and BUNNYDB_TOKEN automatically
let db = BunnyDbClient::from_env().expect("missing BUNNYDB_* env vars");
db.execute(
"CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT NOT NULL)",
(),
).await?;
let result = db.query(
"SELECT id, name FROM users WHERE name = :name",
bunnydb_http::Params::named([("name", bunnydb_http::Value::text("Kit"))]),
).await?;
println!("rows={}", result.rows.len());Structs§
- Bunny
DbClient - HTTP client for Bunny.net Database SQL pipeline endpoint.
- Client
Options - Configures HTTP timeout and retry behavior.
- Col
- Column metadata returned by query responses.
- Exec
Result - Execute response shape.
- Query
Result - Query response shape.
- Statement
- Single statement inside a batch request.
Enums§
- Bunny
DbError - Error type returned by this crate.
- Params
- SQL parameter container.
- Statement
Outcome - Batch outcome per statement.
- Value
- Logical value type used for SQL parameters and decoded rows.
Functions§
- db_
id_ to_ pipeline_ url - Formats a database ID into the canonical pipeline URL.
Type Aliases§
- Result
- Crate-wide result type.