Download api/models/types.py from ZHZ1024/dify: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/ZHZ1024/dify/resolve/main/api/models/types.py
- Command line
-
hf download hf://spaces/ZHZ1024/dify/api/models/types.py
-
curl -L -o types.py https://huggingface.co/spaces/ZHZ1024/dify/resolve/main/api/models/types.py
712 Bytes
| from sqlalchemy import CHAR, TypeDecorator | |
| from sqlalchemy.dialects.postgresql import UUID | |
| class StringUUID(TypeDecorator): | |
| impl = CHAR | |
| cache_ok = True | |
| def process_bind_param(self, value, dialect): | |
| if value is None: | |
| return value | |
| elif dialect.name == "postgresql": | |
| return str(value) | |
| else: | |
| return value.hex | |
| def load_dialect_impl(self, dialect): | |
| if dialect.name == "postgresql": | |
| return dialect.type_descriptor(UUID()) | |
| else: | |
| return dialect.type_descriptor(CHAR(36)) | |
| def process_result_value(self, value, dialect): | |
| if value is None: | |
| return value | |
| return str(value) | |