Update GUID handling to use stdlib UUID.hex instead of an int (#26)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Andrew Bolster 2022-08-27 23:28:09 +01:00 committed by GitHub
parent db3ad598c5
commit 5ea9340def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,10 +47,10 @@ class GUID(TypeDecorator): # type: ignore
return str(value)
else:
if not isinstance(value, uuid.UUID):
return f"{uuid.UUID(value).int:x}"
return uuid.UUID(value).hex
else:
# hexstring
return f"{value.int:x}"
return value.hex
def process_result_value(self, value: Any, dialect: Dialect) -> Optional[uuid.UUID]:
if value is None: