Make the default int an i64 (#3428)

* Make the default int an i64

* fmt

* Fix random integer

* Treat pids as i64 for now
This commit is contained in:
JT
2021-05-14 20:35:09 +12:00
committed by GitHub
parent 440a589f9e
commit d79a3130b8
59 changed files with 693 additions and 284 deletions

View File

@ -41,7 +41,8 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
)
})?)
}
UntaggedValue::Primitive(Primitive::Int(i)) => {
UntaggedValue::Primitive(Primitive::Int(i)) => Bson::I64(*i),
UntaggedValue::Primitive(Primitive::BigInt(i)) => {
Bson::I64(i.tagged(&v.tag).coerce_into("converting to BSON")?)
}
UntaggedValue::Primitive(Primitive::Nothing) => Bson::Null,
@ -50,9 +51,7 @@ pub fn value_to_bson_value(v: &Value) -> Result<Bson, ShellError> {
path.iter()
.map(|x| match &x.unspanned {
UnspannedPathMember::String(string) => Ok(Bson::String(string.clone())),
UnspannedPathMember::Int(int) => Ok(Bson::I64(
int.tagged(&v.tag).coerce_into("converting to BSON")?,
)),
UnspannedPathMember::Int(int) => Ok(Bson::I64(*int)),
})
.collect::<Result<Vec<Bson>, ShellError>>()?,
),
@ -183,7 +182,7 @@ fn get_binary_subtype(tagged_value: &Value) -> Result<BinarySubtype, ShellError>
"md5" => BinarySubtype::Md5,
_ => unreachable!(),
}),
UntaggedValue::Primitive(Primitive::Int(i)) => Ok(BinarySubtype::UserDefined(
UntaggedValue::Primitive(Primitive::BigInt(i)) => Ok(BinarySubtype::UserDefined(
i.tagged(&tagged_value.tag)
.coerce_into("converting to BSON binary subtype")?,
)),