rbatis_codegen/codegen/syntax_tree_pysql/if_node.rs
1use crate::codegen::syntax_tree_pysql::{Name, NodeType};
2
3/// Represents an `if` conditional node in py_sql.
4/// It executes the nested SQL block if the `test` condition evaluates to true.
5///
6/// # Attributes
7///
8/// - `test`: The boolean expression to evaluate.
9///
10/// # Example
11///
12/// PySQL syntax:
13/// ```py
14/// if name != null:
15/// AND name = #{name}
16/// ```
17#[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}