rbatis_codegen/codegen/syntax_tree_pysql/
set_node.rs

1use crate::codegen::syntax_tree_pysql::{Name, NodeType};
2
3/// Represents a `set` node in py_sql.
4/// It's typically used in `UPDATE` statements to dynamically include `SET` clauses.
5/// It will automatically remove trailing commas if present.
6///
7/// # Example
8///
9/// PySQL syntax:
10/// ```py
11/// UPDATE table
12/// set:
13///   if name != null:
14///     name = #{name},
15///   if age != null:
16///     age = #{age},
17/// WHERE id = #{id}
18/// ```
19#[derive(Clone, Debug, Eq, PartialEq)]
20pub struct SetNode {
21    pub childs: Vec<NodeType>,
22    pub collection: String,
23    pub skips: String,
24    pub skip_null: bool,
25}
26
27impl Name for SetNode {
28    fn name() -> &'static str {
29        "set"
30    }
31}