Skip to content

Commit 3b974df

Browse files
committed
workaround for launchbadge#3211
1 parent 028084b commit 3b974df

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sqlx-mysql/src/types/uuid.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@ impl Decode<'_, MySql> for Uuid {
3333
// delegate to the &[u8] type to decode from MySQL
3434
let bytes = <&[u8] as Decode<MySql>>::decode(value)?;
3535

36-
// construct a Uuid from the returned bytes
37-
Uuid::from_slice(bytes).map_err(Into::into)
36+
if bytes.len() == 16 {
37+
// construct a Uuid from the returned bytes
38+
Uuid::from_slice(bytes).map_err(Into::into)
39+
} else {
40+
let text = std::str::from_utf8(bytes)?;
41+
42+
// parse a UUID from the text
43+
Uuid::parse_str(text).map_err(Into::into)
44+
}
3845
}
3946
}
4047

0 commit comments

Comments
 (0)