-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create & Fetch Experiment #18
base: master
Are you sure you want to change the base?
Conversation
f37d7f3
to
910ffec
Compare
|
||
func (store *FakeExperimentStore) FetchByOwner(id entity.ID) (exps []entity.Experiment) { | ||
for _, e := range store.experiments { | ||
if e.Owner == id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if e.Owner == id { | |
if e.OwnerID == id { |
return e | ||
} | ||
|
||
func (store *FakeExperimentStore) FetchByOwner(id entity.ID) (exps []entity.Experiment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (store *FakeExperimentStore) FetchByOwner(id entity.ID) (exps []entity.Experiment) { | |
func (store *FakeExperimentStore) FetchByOwnerID(id entity.ID) (exps []entity.Experiment) { |
type ExperimentStore interface { | ||
Save(entity.Experiment) entity.Experiment | ||
FetchByID(id entity.ID) entity.Experiment | ||
FetchByOwner(ownerID entity.ID) []entity.Experiment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FetchByOwner(ownerID entity.ID) []entity.Experiment | |
FetchByOwnerID(ownerID entity.ID) []entity.Experiment |
} | ||
|
||
func (store *FakeExperimentStore) ErrNotFound() *adapter.ErrExperimentNotFound { | ||
defer func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain what are you doing here?
|
||
type Experiment struct { | ||
Model | ||
Owner ID // todo: define User type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Owner ID // todo: define User type | |
OwnerID ID // todo: define User type |
// This interface is for documentation only. | ||
type experiment interface { | ||
CreateExperiment(userID entity.ID) entity.Experiment | ||
FetchByOwner(ownerID entity.ID) []entity.Experiment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FetchByOwner(ownerID entity.ID) []entity.Experiment | |
FetchByOwnerID(ownerID entity.ID) []entity.Experiment |
return exp | ||
} | ||
|
||
func (e *Experiment) FetchByOwner(ownerID entity.ID) []entity.Experiment { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (e *Experiment) FetchByOwner(ownerID entity.ID) []entity.Experiment { | |
func (e *Experiment) FetchByOwnerID(ownerID entity.ID) []entity.Experiment { |
} | ||
|
||
func (e *Experiment) CreateExperiment(userID entity.ID) entity.Experiment { | ||
exp := e.store.Save(entity.Experiment{Owner: userID}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exp := e.store.Save(entity.Experiment{Owner: userID}) | |
exp := e.store.Save(entity.Experiment{OwnerID: userID}) |
resolve #17
Please review this tomorrow.