Return the content of the last `Text` segment in `sql`, or the whole string if there are no non-text segments.
(sql: &str)
| 37 | /// Return the content of the last `Text` segment in `sql`, or the whole |
| 38 | /// string if there are no non-text segments. |
| 39 | fn last_text_segment(sql: &str) -> &str { |
| 40 | let segs = segments(sql); |
| 41 | for seg in segs.iter().rev() { |
| 42 | if let SqlSegment::Text(t) = seg { |
| 43 | return t; |
| 44 | } |
| 45 | } |
| 46 | "" |
| 47 | } |
| 48 | |
| 49 | /// Extract the right operand after `<->`: ARRAY[...], $param, or identifier. |
| 50 | /// Returns (operand_text, consumed_length). |
no test coverage detected