pub trait BaserowTableOperations {
// Required methods
fn auto_map<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BaserowTable, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait;
fn rows(self) -> RowRequestBuilder;
fn create_one<'async_trait>(
self,
data: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait;
fn get_one<'async_trait>(
self,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait;
fn update<'async_trait>(
self,
id: u64,
data: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Value>, Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait;
fn delete<'async_trait>(
self,
id: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Expand description
Trait defining the public operations available on a Baserow table
This trait provides the core CRUD operations for working with Baserow tables. All operations are async and return Results to handle potential errors.
§Example
use baserow_rs::{ConfigBuilder, Baserow, BaserowTableOperations, api::client::BaserowClient};
use std::collections::HashMap;
use serde_json::Value;
#[tokio::main]
async fn main() {
let config = ConfigBuilder::new()
.base_url("https://api.baserow.io")
.api_key("your-api-key")
.build();
let baserow = Baserow::with_configuration(config);
let table = baserow.table_by_id(1234);
// Create a new record
let mut data = HashMap::new();
data.insert("Name".to_string(), Value::String("Test".to_string()));
let result = table.create_one(data).await.unwrap();
}
Required Methods§
Sourcefn auto_map<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BaserowTable, Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
fn auto_map<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<BaserowTable, Box<dyn Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
Automatically maps the table fields to their corresponding types
This method fetches the table schema and sets up field mappings for type conversion. Call this before performing operations if you need type-safe field access.
Sourcefn rows(self) -> RowRequestBuilder
fn rows(self) -> RowRequestBuilder
Returns a builder for constructing complex table queries
The builder allows you to add filters, sorting, and pagination to your queries. Use this when you need more control over how you fetch rows from the table.
§Example
use baserow_rs::{ConfigBuilder, Baserow, BaserowTableOperations, OrderDirection, api::client::BaserowClient};
#[tokio::main]
async fn main() {
let config = ConfigBuilder::new()
.base_url("https://api.baserow.io")
.api_key("your-api-key")
.build();
let baserow = Baserow::with_configuration(config);
let table = baserow.table_by_id(1234);
let results = table.rows()
.order_by("Created", OrderDirection::Desc)
.get()
.await
.unwrap();
}