Rename repository methods to use store/fetch/update/remove #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We talked about this change recently in a few different conversations, so I went ahead and put it together. These methods are basically CRUD, but the semantics of create/read/update/delete aren't quite right here. Since our domain objects aren't coupled to the underlying storage technologies, we can create an account with the normal Python constructor
Account(email=...)
without storing it anywhere and then decide where/how to store it. This should really come in handy with some of our upcoming data export work, because it will mean that we can create e.g. id mapping objects that are never stored in the database but instead written to files while maintaining an easy path for importing them into the database.It also opens up a possibility for testing our platform code without the database, which is that we can use an
InMemoryWhateverRepository
class (potentially from this repo) that has all the same methods and does all the same things but just holds the objects in memory instead of storing them anywhere. In this repo, we can test that theDb/S3/InMemory
implementations are interchangeable, and inpoprox-platform
we can then avoid having to create mocks for theDb/S3
repositories or stub their individual methods but still be able to test that the platform code works the way we expect without involving a database or S3.