Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Create & Fetch Experiment #18

wants to merge 8 commits into from

Conversation

CreatCodeBuild
Copy link
Contributor

@CreatCodeBuild CreatCodeBuild commented Oct 15, 2018

resolve #17
Please review this tomorrow.

@CreatCodeBuild CreatCodeBuild changed the title Create Experiment Create & Fetch Experiment Oct 15, 2018
@CreatCodeBuild CreatCodeBuild changed the title Create & Fetch Experiment [WIP] Create & Fetch Experiment Oct 16, 2018
@CreatCodeBuild CreatCodeBuild changed the title [WIP] Create & Fetch Experiment Create & Fetch Experiment Oct 16, 2018

func (store *FakeExperimentStore) FetchByOwner(id entity.ID) (exps []entity.Experiment) {
for _, e := range store.experiments {
if e.Owner == id {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if e.Owner == id {
if e.OwnerID == id {

return e
}

func (store *FakeExperimentStore) FetchByOwner(id entity.ID) (exps []entity.Experiment) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FetchByOwner(ownerID entity.ID) []entity.Experiment
FetchByOwnerID(ownerID entity.ID) []entity.Experiment

}

func (store *FakeExperimentStore) ErrNotFound() *adapter.ErrExperimentNotFound {
defer func() {
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
FetchByOwner(ownerID entity.ID) []entity.Experiment
FetchByOwnerID(ownerID entity.ID) []entity.Experiment

return exp
}

func (e *Experiment) FetchByOwner(ownerID entity.ID) []entity.Experiment {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exp := e.store.Save(entity.Experiment{Owner: userID})
exp := e.store.Save(entity.Experiment{OwnerID: userID})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Use Case: Create&Fetch Experiment
2 participants