diff --git a/src/scalars/integers.rs b/src/scalars/integers.rs index 35f4be67..94ff5311 100644 --- a/src/scalars/integers.rs +++ b/src/scalars/integers.rs @@ -134,6 +134,29 @@ impl ScalarType for i64 { } } +/// The `Int64` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^64) and 2^64 - 1. +#[Scalar(internal, name = "Int64")] +impl ScalarType for u32 { + fn parse(value: Value) -> InputValueResult { + match value { + Value::Int(n) => Ok(n as Self), + Value::String(s) => Ok(s.parse()?), + _ => Err(InputValueError::ExpectedType(value)), + } + } + + fn is_valid(value: &Value) -> bool { + match value { + Value::Int(_) | Value::String(_) => true, + _ => false, + } + } + + fn to_value(&self) -> Value { + Value::String(self.to_string()) + } +} + /// The `Int64` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^64) and 2^64 - 1. #[Scalar(internal, name = "Int64")] impl ScalarType for u64 {