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

lh-api #4

Merged
merged 22 commits into from
Oct 24, 2023
Merged

lh-api #4

merged 22 commits into from
Oct 24, 2023

Conversation

uv-orbs
Copy link
Member

@uv-orbs uv-orbs commented Oct 15, 2023

No description provided.

@uv-orbs uv-orbs changed the title skeleton lh-api Oct 24, 2023
cmd-lh/main.go Outdated Show resolved Hide resolved
newOrder(1001, 2),
newOrder(1002, 3),
},
index: -1,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't index start at 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

no as first action is promotion

}
// create order iter
return &OrderIter{
index: -1,
Copy link
Member

Choose a reason for hiding this comment

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

Why initialise this with -1? Better to start with 0 so it aligns with how we usually think about array indexes?

Copy link
Member Author

Choose a reason for hiding this comment

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

i like the use of -1 as in "not been used" rather than 0 which is more implicit in case of only one order in the array

}

func (i *OrderIter) Next() *models.Order {
ctx := context.Background()
Copy link
Member

Choose a reason for hiding this comment

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

We can leave this for now, but this context should be from a function argument (eg. Next(ctx context.Context) so that we're using the same context all the way through the app

Copy link
Member Author

Choose a reason for hiding this comment

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

agreed

return &OrderIter{
index: -1,
ids: orderIDs,
redis: r,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you are using this redis property anywhere? Can it be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

will remove it

Copy link
Member Author

Choose a reason for hiding this comment

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

taking it back, ofcourse it is used in t he redis impl

service/lh.go Outdated
@@ -0,0 +1,95 @@
package service
Copy link
Member

Choose a reason for hiding this comment

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

Please add logs to the methods below

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@Luke-Rogerson
Copy link
Member

Left some feedback

@uv-orbs uv-orbs merged commit 79f2376 into main Oct 24, 2023
1 check passed
@uv-orbs uv-orbs deleted the lh-api branch October 24, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants