Skip to content

Commit 6d55e9d

Browse files
committed
feat(queries): add result_id to list table, database_id to detail view
- queries list now shows RESULT_ID column alongside query ID, replacing DURATION_MS (still visible in queries get detail view) - SQL truncation reduced from 60 to 40 chars to fit the wider table - QueryRun struct gains database_id field (serde default) so the detail view will surface it automatically once the API starts returning it
1 parent 4a253d8 commit 6d55e9d

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/queries.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ struct QueryRun {
125125
sql_hash: String,
126126
sql_text: String,
127127
result_id: Option<String>,
128+
#[serde(default)]
129+
database_id: Option<String>,
128130
error_message: Option<String>,
129131
warning_message: Option<String>,
130132
trace_id: Option<String>,
@@ -193,18 +195,22 @@ pub fn list(
193195
r.id.clone(),
194196
color_status(&r.status),
195197
crate::util::format_date(&r.created_at),
196-
r.execution_time_ms
197-
.map(|ms| ms.to_string())
198-
.unwrap_or_else(|| "-".to_string()),
199198
r.row_count
200199
.map(|n| n.to_string())
201200
.unwrap_or_else(|| "-".to_string()),
202-
truncate_sql(&r.sql_text, 60),
201+
r.result_id
202+
.as_deref()
203+
.map(|id| {
204+
let prefix: String = id.chars().take(8).collect();
205+
format!("{prefix}…")
206+
})
207+
.unwrap_or_else(|| "-".to_string()),
208+
truncate_sql(&r.sql_text, 40),
203209
]
204210
})
205211
.collect();
206212
crate::table::print(
207-
&["ID", "STATUS", "CREATED", "DURATION_MS", "ROWS", "SQL"],
213+
&["ID", "STATUS", "CREATED", "ROWS", "RESULT", "SQL"],
208214
&rows,
209215
);
210216
}
@@ -259,6 +265,9 @@ fn print_detail(r: &QueryRun, format: &str) {
259265
if let Some(ref id) = r.result_id {
260266
println!("{}{}", label("result id:"), id);
261267
}
268+
if let Some(ref id) = r.database_id {
269+
println!("{}{}", label("database id:"), id);
270+
}
262271
if let Some(ref id) = r.saved_query_id {
263272
let version = r
264273
.saved_query_version

0 commit comments

Comments
 (0)