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

Method cast_to_smallint

graphlite/src/exec/executor.rs:5088–5103  ·  view source on GitHub ↗

Cast value to SMALLINT

(&self, value: Value)

Source from the content-addressed store, hash-verified

5086
5087 /// Cast value to SMALLINT
5088 fn cast_to_smallint(&self, value: Value) -> Result<Value, ExecutionError> {
5089 let int_value = self.cast_to_integer(value)?;
5090 match int_value {
5091 Value::Number(n) => {
5092 if (-32768.0..=32767.0).contains(&n) {
5093 Ok(Value::Number(n))
5094 } else {
5095 Err(ExecutionError::RuntimeError(format!(
5096 "Value {} is out of range for SMALLINT",
5097 n
5098 )))
5099 }
5100 }
5101 other => Ok(other), // Pass through Null
5102 }
5103 }
5104
5105 /// Cast value to FLOAT
5106 fn cast_to_float(&self, value: Value) -> Result<Value, ExecutionError> {

Callers 1

cast_valueMethod · 0.80

Calls 2

cast_to_integerMethod · 0.80
containsMethod · 0.80

Tested by

no test coverage detected