-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not persisting hours after creating them with the in-memory repository #4
Comments
That should be documented better 😉. In general, the idea is, that the repository should be independent of the database, but be rather some domain concept. By example it will be probably more clear: In practice (not in the database, in reality) hour exists, even if it was not persisted. So for example, if we didn't persist 14:00 it exists anyway and is available for training. So that's why it is not persisted in If we want to persist it, we need to explicitly call Does it make sense for you? |
What I was saying, is that you're just returning a newly created hour without putting it to the map.
This should be IMO: currentHour, err := m.hourFactory.NewNotAvailableHour(hourTime)
// Handle error, skipped
m.hours[hourTime] = *currentHour Otherwise your in-memory storage doesn't make much sense. |
@msamoylov It's persisted in the
The result of |
So, you're creating a new
Hour
, but returning it immediately without storing it in the map.wild-workouts-go-ddd-example/internal/trainer/adapters/hour_memory_repository.go
Line 40 in 22c0a25
It looks like
ok
will be alwaysfalse
.wild-workouts-go-ddd-example/internal/trainer/adapters/hour_memory_repository.go
Line 38 in 22c0a25
Am I missing something here?
The text was updated successfully, but these errors were encountered: