Skip to main content

Crate bunnydb_rs

Crate bunnydb_rs 

Source
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:

ConstructorWhen to use
BunnyDbClient::from_env12-factor / container: BUNNYDB_PIPELINE_URL + BUNNYDB_TOKEN
BunnyDbClient::from_env_db_idEdge scripts / containers: BUNNYDB_ID + BUNNYDB_TOKEN
BunnyDbClient::from_db_idHardcoded DB ID, token from config
BunnyDbClient::new_bearerFull URL + bearer token
BunnyDbClient::new_raw_authFull 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§

BunnyDbClient
HTTP client for Bunny.net Database SQL pipeline endpoint.
ClientOptions
Configures HTTP timeout and retry behavior.
Col
Column metadata returned by query responses.
ExecResult
Execute response shape.
QueryResult
Query response shape.
Statement
Single statement inside a batch request.

Enums§

BunnyDbError
Error type returned by this crate.
Params
SQL parameter container.
StatementOutcome
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.