mirror of
				https://github.com/fastapi/sqlmodel.git
				synced 2025-11-04 14:47:08 +08: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:
		@ -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:
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user