Open frederikhors opened 2 years ago
Hey @frederikhors.
Sure, there's no issue with using pointers to repositories or other adapters. In most cases, you would find the effect on memory negligible, though. In the example above, the only field of the struct is a pointer, so copying it won't be noticeable in any way.
Ok. But I'm not able to use pointers. The compiler reject it. Can you try?
What error did you get? You will probably need to change some occurrences in the code to match pointers, but it should be straightforward.
Given the repository in repository.go:
we are creating new structs which implement that interface using code such as in trainings_firestore_repository.go:
and we are create commands and queries with those structs, such as in service.go:
satisfying func signature like:
Question
In each func like
command.NewApproveTrainingRescheduleHandler(trainingsRepository, /*...*/)
we are passingtrainingsRepository
each time different (passed-by-value).Can we use a pointer there avoiding maybe useless memory consumption?