69 lines
1.5 KiB
Rust
69 lines
1.5 KiB
Rust
use serde::Deserialize;
|
|
use serde_json::Value;
|
|
|
|
#[derive(Deserialize)]
|
|
pub(crate) struct QueryInput {
|
|
pub profile_name: String,
|
|
pub sql: String,
|
|
#[serde(default = "default_max_rows")]
|
|
pub max_rows: u32,
|
|
pub chart_type: String,
|
|
}
|
|
|
|
fn default_max_rows() -> u32 {
|
|
1000
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub(crate) struct CatalogInput {
|
|
pub profile_name: String,
|
|
}
|
|
|
|
/// One entry of the profile `<select>` on the analytics page.
|
|
pub(crate) struct ProfileOption {
|
|
pub name: String,
|
|
pub table_count: usize,
|
|
}
|
|
|
|
pub(crate) struct QueryOutput {
|
|
pub columns: Vec<ColumnOutput>,
|
|
pub rows: Vec<Vec<Value>>,
|
|
pub row_count: u64,
|
|
pub elapsed_ms: u64,
|
|
pub truncated: bool,
|
|
}
|
|
|
|
pub(crate) struct ColumnOutput {
|
|
pub name: String,
|
|
#[allow(dead_code)]
|
|
pub data_type: String,
|
|
}
|
|
|
|
/// The catalog sidebar, already shaped for `catalog.html` so the
|
|
/// template holds no SQL-quoting or label-building logic.
|
|
pub(crate) struct CatalogView {
|
|
pub tables: Vec<CatalogTableView>,
|
|
pub llm_context: String,
|
|
}
|
|
|
|
pub(crate) struct CatalogTableView {
|
|
pub name: String,
|
|
pub base_currency: String,
|
|
pub starter_query: String,
|
|
pub columns: Vec<CatalogColumnView>,
|
|
pub links: Vec<CatalogLinkView>,
|
|
}
|
|
|
|
pub(crate) struct CatalogColumnView {
|
|
pub name: String,
|
|
/// The quoted identifier inserted into the SQL box when clicked.
|
|
pub insert_text: String,
|
|
pub details: String,
|
|
}
|
|
|
|
pub(crate) struct CatalogLinkView {
|
|
pub source_column: String,
|
|
pub linked_table: String,
|
|
pub required: bool,
|
|
}
|