Added u32 as ScalarType
This commit is contained in:
parent
4135beae2c
commit
11d7a8cbdb
@ -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<Self> {
|
||||||
|
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.
|
/// 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")]
|
#[Scalar(internal, name = "Int64")]
|
||||||
impl ScalarType for u64 {
|
impl ScalarType for u64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user