Skip to content

Commit 9ba19cd

Browse files
committed
feat(cozo-core): Add 'default_expr' column to output of '::columns'
Signed-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
1 parent 51581fb commit 9ba19cd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • cozo-core/src/runtime

cozo-core/src/runtime/db.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,22 +1777,28 @@ impl<'s, S: Storage<'s>> Db<S> {
17771777
let mut rows = vec![];
17781778
let mut idx = 0;
17791779
for col in &handle.metadata.keys {
1780+
let default_expr = col.default_gen.as_ref().map(|gen| format!("{}", gen));
1781+
17801782
rows.push(vec![
17811783
json!(col.name),
17821784
json!(true),
17831785
json!(idx),
17841786
json!(col.typing.to_string()),
17851787
json!(col.default_gen.is_some()),
1788+
json!(default_expr),
17861789
]);
17871790
idx += 1;
17881791
}
17891792
for col in &handle.metadata.non_keys {
1793+
let default_expr = col.default_gen.as_ref().map(|gen| format!("{}", gen));
1794+
17901795
rows.push(vec![
17911796
json!(col.name),
17921797
json!(false),
17931798
json!(idx),
17941799
json!(col.typing.to_string()),
17951800
json!(col.default_gen.is_some()),
1801+
json!(default_expr),
17961802
]);
17971803
idx += 1;
17981804
}
@@ -1807,6 +1813,7 @@ impl<'s, S: Storage<'s>> Db<S> {
18071813
"index".to_string(),
18081814
"type".to_string(),
18091815
"has_default".to_string(),
1816+
"default_expr".to_string(),
18101817
],
18111818
rows,
18121819
))

0 commit comments

Comments
 (0)