MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / last_text_segment

Function last_text_segment

nodedb-sql/src/parser/preprocess/vector_ops.rs:39–47  ·  view source on GitHub ↗

Return the content of the last `Text` segment in `sql`, or the whole string if there are no non-text segments.

(sql: &str)

Source from the content-addressed store, hash-verified

37/// Return the content of the last `Text` segment in `sql`, or the whole
38/// string if there are no non-text segments.
39fn 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).

Callers 1

extract_left_operandFunction · 0.85

Calls 2

segmentsFunction · 0.85
iterMethod · 0.45

Tested by

no test coverage detected