1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use nu_protocol::Config;
use nu_table::{Alignments, Table};
use std::collections::HashMap;

pub mod database;
mod error;
pub mod execute;
pub mod query;

pub trait Print {
    fn print(&self) -> Result<(), &'static str> {
        let table = self.covert_table();
        let cfg = Config::default();
        let styles = HashMap::default();
        let alignments = Alignments::default();

        let p = table
            .draw_table(&cfg, &styles, alignments, usize::MAX)
            .ok_or("convert table to string error")?;
        debug!("\n{}", p);
        Ok(())
    }

    fn covert_table(&self) -> Table;
}