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

Method add_op

crates/gitql-core/src/values/date.rs:53–60  ·  view source on GitHub ↗
(&self, other: &Box<dyn Value>)

Source from the content-addressed store, hash-verified

51 }
52
53 fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
54 if let Some(days) = other.as_int() {
55 let days_to_timestamp = days * 24 * 60 * 60;
56 let timestamp = self.timestamp + days_to_timestamp;
57 return Ok(Box::new(DateValue::new(timestamp)));
58 }
59 Err("Unexpected type to perform `+` with".to_string())
60 }
61
62 fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
63 if let Some(days) = other.as_int() {

Callers 1

evaluate_arithmeticFunction · 0.45

Calls 1

as_intMethod · 0.80

Tested by

no test coverage detected