MCPcopy Create free account
hub / github.com/JasonShin/sqlx-ts / is_comment_only

Function is_comment_only

src/parser/sql_parser.rs:152–168  ·  view source on GitHub ↗

Check if a block contains only comments and whitespace

(block: &str)

Source from the content-addressed store, hash-verified

150
151/// Check if a block contains only comments and whitespace
152fn is_comment_only(block: &str) -> bool {
153 let lines: Vec<&str> = block.lines().collect();
154
155 for line in lines {
156 let trimmed = line.trim();
157 if trimmed.is_empty() {
158 continue;
159 }
160
161 // Check if line starts with comment markers
162 if !trimmed.starts_with("--") && !trimmed.starts_with("/*") && !trimmed.starts_with("*") {
163 return false;
164 }
165 }
166
167 true
168}
169
170/// Extract annotations from SQL content and return cleaned query
171/// Supports @name and @db annotations

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected