gluesql_core/ast_builder/
show_columns.rs1use {
2 super::Build,
3 crate::{ast::Statement, result::Result},
4};
5
6#[derive(Clone, Debug)]
7pub struct ShowColumnsNode {
8 table_name: String,
9}
10
11impl ShowColumnsNode {
12 pub fn new(table_name: String) -> Self {
13 Self { table_name }
14 }
15}
16
17impl Build for ShowColumnsNode {
18 fn build(self) -> Result<Statement> {
19 let table_name = self.table_name;
20 Ok(Statement::ShowColumns { table_name })
21 }
22}
23
24#[cfg(test)]
25mod tests {
26 use crate::ast_builder::{Build, table, test};
27
28 #[test]
29 fn show_columns() {
30 let actual = table("Foo").show_columns().build();
31 let expected = "SHOW COLUMNS FROM Foo";
32 test(actual, expected);
33 }
34}