This is the Rust SDK for SBXCloud. It is a work in progress and is not yet ready for production use.
SBXHOST: The host of the SBXCloud instance, this will default to https://sbxcloud.com
SBXTOKEN: The token to use for authentication (Required)
SBXAPPKEY: The app key to use for authentication (Optional)
SBX_DOMAIN: The domain context from SBXCloud where the data is stored (Required), this must be a positive number
The library requires you to use an async runtime, so you will need to use an async runtime to use this library. The examples below use tokio.
```rust use sbxcloud::models::{QueryBuilder, SBXClient}; use sbxcloud::services::load_all;
struct Purchase { #[serde(rename(serialize = "KET", deserialize = "KEY"))] key: String, consecutive: u32, }
async fn main() -> Result<(), Box
// Search for for all the items on the purchase table
let q = QueryBuilder::new("purchase", sbx.domain)
// fetch the associated customer
.fetch(vec![String::from("customer")])
// where the packing date of the order is equal to a given date
.and_equals("packing_date", date)
// and the checkout is not null
.and_is_not_null("checkout")
// compile the query
.build();
// perform the query and load all the results
match load_all::<Purchase>(&sbx, &q).await {
Ok((purchases, fetch)) => {
println!("Found {} purchases", purchases.len());
// print out the purchases
for purchase in purchases.iter() {
println!("Purchase: {}", purchase.key);
}
println!("Found {} fetches", fetch.len());
Ok(())
}
Err(e) => {
println!("Error: {}", e);
Err(e)
}
}
} ```