Skip to content

StreamId

Bases: StreamUUID

Source code in event_sourcery/event_store/stream_id.py
@dataclass(frozen=True, repr=False, eq=False)
class StreamId(StreamUUID):
    category: Category | None = None

    def __repr__(self) -> str:
        return (
            f"{type(self).__name__}"
            f"(hex={self!s}, name={self.name}, category={self.category})"
        )

    def __eq__(self, other: Any) -> bool:
        if isinstance(other, StreamId):
            return super().__eq__(other) and self.category == other.category
        return NotImplemented

    def __hash__(self) -> int:
        return hash((self.category, super().__hash__()))