Skip to content

Commit 1efdbdf

Browse files
committed
support null values for optional int, float fields on save method
Signed-off-by: wiseaidev <[email protected]>
1 parent 2b74294 commit 1efdbdf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

aredis_om/model/model.py

+2
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,8 @@ async def save(self, pipeline: Optional[Pipeline] = None) -> "HashModel":
12911291
db = pipeline
12921292
document = jsonable_encoder(self.dict())
12931293
# TODO: Wrap any Redis response errors in a custom exception?
1294+
# store null values as string zero: "0"
1295+
document = {key: val if val else "0" for key, val in document.items()}
12941296
await db.hset(self.key(), mapping=document)
12951297
return self
12961298

0 commit comments

Comments
 (0)