HENNGE / aiodynamo

Asynchronous, fast, pythonic DynamoDB Client
https://aiodynamo.readthedocs.io/
Other
73 stars 21 forks source link

Add __eq__ and __repr__ to aiodynamo.expressions.F #111

Closed ojii closed 2 years ago

ojii commented 2 years ago

Fixes #110

Instances of F can now be compared for equality if their paths match and provide a reasonable repr. The changes to UpdateExpression included here are because implementing eq for F means that setting the same field twice in an update expresssion would ignore one of the values. This changes the behaviour of F("a").set("a") & F("a").set("b") which currently raises a (DynamoDB-side) error, but no longer raised one after implementing eq. Switching from Dict[F, T] to List[Tuple[F, T]] preserves the current behaviour and invalid update expressions correctly raise an error.