# Athena SDK Examples

These examples focus on gateway-first SDK usage and shared query primitives.

- `athena_client_sdk.rs`: baseline SDK setup and multi-backend construction.
- `supabase_health_tracking.rs`: health-aware Supabase client circuit-breaker flow.
- `gateway_endpoints.rs`: inspect canonical gateway route constants and resolved endpoints.
- `gateway_routes_static.rs`: build endpoint URLs directly from constants and helpers.
- `gateway_fetch_builder.rs`: select/fetch with filters, ordering, limit, and offset.
- `gateway_insert_builder.rs`: insert payloads via the insert builder.
- `gateway_update_builder.rs`: condition-based update with shared update builder methods.
- `gateway_delete_builder.rs`: condition-based delete with shared delete builder methods.
- `gateway_row_id_shortcuts.rs`: `update_by_id` and `delete_by_id` shortcut APIs.
- `gateway_sql.rs`: raw SQL via `AthenaClient::sql`.
- `gateway_rpc_builder.rs`: Postgres function RPC calls via `AthenaClient::rpc` with args, filters, and count.
- `gateway_alias_methods.rs`: athena-js-style aliases (`fetch` and `sql`).
- `gateway_typed_requests.rs`: typed request structs (`Gateway*Request`) for CRUD + SQL.
- `gateway_shared_conditions.rs`: build reusable `Condition` vectors once and reuse them.
- `gateway_complex_filters.rs`: mixed `eq/neq/gt/lt/in` filter composition.
- `gateway_raw_select_nested.rs`: nested PostgREST-style `raw_select` query usage.
- `gateway_bulk_workflow.rs`: practical insert -> fetch -> update -> delete workflow.
- `perf_insert_duplicate_replay.rs`: PERF-01 duplicate-heavy `/gateway/insert` replay (25/50/100 workers) with p50/p95/p99 + queue/fallback metric deltas.

Run any example:

```bash
cargo run --example gateway_fetch_builder

# PERF-01 replay example
cargo run --example perf_insert_duplicate_replay -- \
	--base-url http://localhost:4052 \
	--client athena_logging \
	--table cz_companies \
	--duplicate-key registration_number \
	--duplicate-value PERF-01-DUP-001 \
	--seed-before-each-scenario \
	--label after
```
