//! Example: nested PostgREST-style `raw_select` relation expansion.
use athena_rs::{AthenaClient, QueryResult};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let client: AthenaClient =
        AthenaClient::new("http://localhost:4052", "secret", "reporting").await?;

    let result: QueryResult = client
        .fetch("authors")
        .raw_select("id,name,posts!author_id(id,title)")
        .where_eq("status", "active")
        .limit(20)
        .execute()
        .await?;

    println!("Rows: {}", result.rows.len());
    Ok(())
}
