1use crate::core::row::Row;
2
3pub(crate) struct RowBuilder(Row);
4
5impl RowBuilder {
6 pub(crate) fn new() -> Self {
7 Self(Row::new())
8 }
9
10 pub(crate) fn insert<K, V>(&mut self, key: K, value: V) -> &mut Self
11 where
12 K: Into<String>,
13 V: Into<serde_json::Value>,
14 {
15 self.0.insert(key.into(), value.into());
16 self
17 }
18
19 pub(crate) fn build(self) -> Row {
20 self.0
21 }
22}
23
24#[macro_export]
25macro_rules! row {
26 ($($key:expr => $value:expr),* $(,)?) => {{
27 let mut builder = $crate::cli::rows::row::RowBuilder::new();
28 $(builder.insert($key, $value);)*
29 builder.build()
30 }};
31}
32
33