Skip to content

Commit 32841b3

Browse files
authored
feat: Type object hashing (#203)
1 parent 39f31f1 commit 32841b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/firebolt/async_db/_types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def __init__(self, precision: int, scale: int):
120120
def __str__(self) -> str:
121121
return f"Decimal({self.precision}, {self.scale})"
122122

123+
def __hash__(self) -> int:
124+
return hash(str(self))
125+
123126
def __eq__(self, other: object) -> bool:
124127
if not isinstance(other, DECIMAL):
125128
return NotImplemented
@@ -137,6 +140,9 @@ def __init__(self, precision: int):
137140
def __str__(self) -> str:
138141
return f"DateTime64({self.precision})"
139142

143+
def __hash__(self) -> int:
144+
return hash(str(self))
145+
140146
def __eq__(self, other: object) -> bool:
141147
if not isinstance(other, DATETIME64):
142148
return NotImplemented

0 commit comments

Comments
 (0)