MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / cast_op

Method cast_op

crates/gitql-core/src/values/text.rs:333–351  ·  view source on GitHub ↗
(&self, target_type: &Box<dyn DataType>)

Source from the content-addressed store, hash-verified

331 }
332
333 fn cast_op(&self, target_type: &Box<dyn DataType>) -> Result<Box<dyn Value>, String> {
334 if target_type.is_bool() {
335 return Ok(string_literal_to_boolean(&self.value));
336 }
337
338 if target_type.is_time() {
339 return Ok(string_literal_to_time(&self.value));
340 }
341
342 if target_type.is_date() {
343 return Ok(string_literal_to_date(&self.value));
344 }
345
346 if target_type.is_date_time() {
347 return Ok(string_literal_to_date_time(&self.value));
348 }
349
350 Err("Unexpected value to perform `CAST` with".to_string())
351 }
352}

Callers 1

evaluate_castFunction · 0.45

Calls 8

string_literal_to_timeFunction · 0.85
string_literal_to_dateFunction · 0.85
is_boolMethod · 0.45
is_timeMethod · 0.45
is_dateMethod · 0.45
is_date_timeMethod · 0.45

Tested by

no test coverage detected