pub async fn export_data(
model_name: String,
format: ExportFormat,
site: Depends<AdminSiteKey, AdminSite>,
db: Depends<AdminDatabaseKey, AdminDatabase>,
http_request: ServerFnRequest,
__arg5: AdminAuthenticatedUser,
) -> Result<ExportResponse, ServerFnError>Available on not (
target_family=wasm and target_os=unknown).Expand description
Export model data in various formats
Exports all records from a model table in the specified format (JSON, CSV, TSV). Returns the exported data as binary content with appropriate content type and filename.
§Server Function
This function is automatically exposed as an HTTP endpoint by the #[server_fn] macro.
AdminSite and AdminDatabase dependencies are automatically injected via the DI system.
§Authentication
Requires staff (admin) permission and view permission for the model.
§Example
ⓘ
use reinhardt_admin::server::export_data;
use reinhardt_admin::types::ExportFormat;
// Client-side usage (automatically generates HTTP request)
let response = export_data("User".to_string(), ExportFormat::JSON).await?;
println!("Downloaded {}", response.filename);