rbatis_codegen/codegen/syntax_tree_pysql/
if_node.rs1use crate::codegen::syntax_tree_pysql::{Name, NodeType, ToHtml};
2
3#[derive(Clone, Debug, Eq, PartialEq)]
18pub struct IfNode {
19 pub childs: Vec<NodeType>,
20 pub test: String,
21}
22
23impl Name for IfNode {
24 fn name() -> &'static str {
25 "if"
26 }
27}
28
29
30impl ToHtml for IfNode {
31 fn as_html(&self) -> String {
32 let mut childs = String::new();
33 for x in &self.childs {
34 childs.push_str(&x.as_html());
35 }
36 format!("<if test=\"{}\">{}</if>", self.test, childs)
37 }
38}