You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys ! I was wondering why the Training struct is public... I mean, what happen if someone creates a Trining bypassing all required validations that exist in NewTraining ?
You can create a Training outside of the pacakge, but since all its fields are unexported, you won't be able to fill them. So in worst-case scenario, you'll create an empty training.
To make sure the passed value is valid, you can keep a check like if training == Training{} or have a dedicated training.IsZero() method.
Hey guys ! I was wondering why the Training struct is public... I mean, what happen if someone creates a Trining bypassing all required validations that exist in NewTraining ?
Thank you !
wild-workouts-go-ddd-example/internal/trainings/domain/training/training.go
Line 10 in c727325
The text was updated successfully, but these errors were encountered: