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
29impl ToHtml for IfNode {
30 fn as_html(&self) -> String {
31 let mut childs = String::new();
32 for x in &self.childs {
33 childs.push_str(&x.as_html());
34 }
35 format!("<if test=\"{}\">{}</if>", self.test, childs)
36 }
37}