rbatis_codegen/codegen/syntax_tree_pysql/break_node.rs
1use crate::codegen::syntax_tree_pysql::{ToHtml, Name};
2
3/// Represents a `break` node in py_sql.
4/// It's used to exit a loop, typically within a `foreach` block.
5///
6/// # Example
7///
8/// PySQL syntax:
9/// ```py
10/// for item in collection:
11/// if item == 'something':
12/// break
13/// ```
14#[derive(Clone, Debug, Eq, PartialEq)]
15pub struct BreakNode {}
16
17impl ToHtml for BreakNode {
18 fn as_html(&self) -> String {
19 format!("<break/>")
20 }
21}
22
23impl Name for BreakNode {
24 fn name() -> &'static str {
25 "break"
26 }
27}