MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / value_to_string

Method value_to_string

graphlite/src/functions/string_functions.rs:277–289  ·  view source on GitHub ↗

Helper method to convert value to string consistently

(&self, value: &Value)

Source from the content-addressed store, hash-verified

275impl TrimFunction {
276 /// Helper method to convert value to string consistently
277 fn value_to_string(&self, value: &Value) -> FunctionResult<String> {
278 let string_val = if let Some(s) = value.as_string() {
279 s.to_string()
280 } else if let Some(n) = value.as_number() {
281 n.to_string()
282 } else {
283 match value {
284 Value::Boolean(b) => b.to_string(),
285 _ => return Ok(String::new()), // Return empty for non-convertible types
286 }
287 };
288 Ok(string_val)
289 }
290
291 /// Helper method to extract trim character from value
292 fn extract_trim_char(&self, value: &Value) -> FunctionResult<char> {

Callers 1

executeMethod · 0.45

Calls 2

as_numberMethod · 0.80
as_stringMethod · 0.45

Tested by

no test coverage detected