erikhuck / role-play-adventure

0 stars 0 forks source link

Immutable database properties #5

Closed erikhuck closed 4 weeks ago

erikhuck commented 3 months ago

The database should only be able to be modified internally and not by the other parts of the code base (i.e. to prevent me from changing it without saving).

The dataclass decorator has a frozen parameter that causes an exception to be raised whenever a change is made to a dataclass. If a change does need to be made, then a new dataclass should be constructed.

Likewise, all dictionaries should be immutable using an immutabledict. New dictionaries should be constructed if they need to be changed in the database class.