mirror of
https://github.com/PaiGramTeam/sqlmodel.git
synced 2024-11-29 02:27:32 +00:00
✨ 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:
parent
db3ad598c5
commit
5ea9340def
@ -47,10 +47,10 @@ class GUID(TypeDecorator): # type: ignore
|
|||||||
return str(value)
|
return str(value)
|
||||||
else:
|
else:
|
||||||
if not isinstance(value, uuid.UUID):
|
if not isinstance(value, uuid.UUID):
|
||||||
return f"{uuid.UUID(value).int:x}"
|
return uuid.UUID(value).hex
|
||||||
else:
|
else:
|
||||||
# hexstring
|
# hexstring
|
||||||
return f"{value.int:x}"
|
return value.hex
|
||||||
|
|
||||||
def process_result_value(self, value: Any, dialect: Dialect) -> Optional[uuid.UUID]:
|
def process_result_value(self, value: Any, dialect: Dialect) -> Optional[uuid.UUID]:
|
||||||
if value is None:
|
if value is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user