Skip to content

add ForEachCondition implement - #485

Merged
samber merged 5 commits into
samber:masterfrom
Sianao:feature/conditionForeach
Jul 15, 2024
Merged

samber merged 5 commits into
samber:masterfrom
Sianao:feature/conditionForeach

Conversation

@Sianao

@Sianao Sianao commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

In certain cases, we want to control whether the foreach continues to execute, such as checking if a set of data meets certain criteria. ForEachCondition implements this functionality to address this need

@samber

samber commented Jul 2, 2024

Copy link
Copy Markdown
Owner

Good one! ✌️

I wonder if we should rename it to ForEachWhile? 🤔 It would harmonize the name of helpers that finish executing with a condition: DropWhile, AttemptWhile.

Feel free to argue about it, or propose another name!

@Sianao

Sianao commented Jul 2, 2024

Copy link
Copy Markdown
Contributor Author

I agreee with you , it like do while in other language !

@Sianao

Sianao commented Jul 14, 2024

Copy link
Copy Markdown
Contributor Author

Sir , is any problem with this pull request ?

@samber
samber merged commit cbfd1c6 into samber:master Jul 15, 2024
github-actions Bot referenced this pull request in kairos-io/provider-kairos Jul 15, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/samber/lo](https://togithub.com/samber/lo) | `v1.45.0` ->
`v1.46.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fsamber%2flo/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fsamber%2flo/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fsamber%2flo/v1.45.0/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fsamber%2flo/v1.45.0/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

samber/lo (github.com/samber/lo) ### [`v1.46.0`](https://togithub.com/samber/lo/releases/tag/v1.46.0) [Compare Source](https://togithub.com/samber/lo/compare/v1.45.0...v1.46.0) #### What's Changed - fix: chunk memory leak, bug fix by [@​mihir20](https://togithub.com/mihir20) in [https://github.com/samber/lo/pull/491](https://togithub.com/samber/lo/pull/491) - feat: add WaitForWithContext by [@​ccoVeille](https://togithub.com/ccoVeille) in [https://github.com/samber/lo/pull/480](https://togithub.com/samber/lo/pull/480) - add ForEachCondition implement by [@​Sianao](https://togithub.com/Sianao) in [https://github.com/samber/lo/pull/485](https://togithub.com/samber/lo/pull/485) #### New Contributors - [@​mihir20](https://togithub.com/mihir20) made their first contribution in [https://github.com/samber/lo/pull/491](https://togithub.com/samber/lo/pull/491) - [@​ccoVeille](https://togithub.com/ccoVeille) made their first contribution in [https://github.com/samber/lo/pull/480](https://togithub.com/samber/lo/pull/480) - [@​Sianao](https://togithub.com/Sianao) made their first contribution in [https://github.com/samber/lo/pull/485](https://togithub.com/samber/lo/pull/485) **Full Changelog**: samber/lo@v1.45.0...v1.46.0
--- ### Configuration 📅 **Schedule**: Branch creation - "after 11pm every weekday,before 7am every weekday,every weekend" in timezone Europe/Brussels, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/kairos-io/provider-kairos). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@printercu

Copy link
Copy Markdown

I see a lot of new features landing recently. What is the benefit of using this function over "for i := range"?

codeboten referenced this pull request in open-telemetry/opentelemetry-collector-contrib Jul 17, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/samber/lo](https://togithub.com/samber/lo) | `v1.44.0` ->
`v1.46.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fsamber%2flo/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fsamber%2flo/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fsamber%2flo/v1.44.0/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fsamber%2flo/v1.44.0/v1.46.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

samber/lo (github.com/samber/lo) ### [`v1.46.0`](https://togithub.com/samber/lo/releases/tag/v1.46.0) [Compare Source](https://togithub.com/samber/lo/compare/v1.45.0...v1.46.0) #### What's Changed - fix: chunk memory leak, bug fix by [@&#8203;mihir20](https://togithub.com/mihir20) in [https://github.com/samber/lo/pull/491](https://togithub.com/samber/lo/pull/491) - feat: add WaitForWithContext by [@&#8203;ccoVeille](https://togithub.com/ccoVeille) in [https://github.com/samber/lo/pull/480](https://togithub.com/samber/lo/pull/480) - add ForEachCondition implement by [@&#8203;Sianao](https://togithub.com/Sianao) in [https://github.com/samber/lo/pull/485](https://togithub.com/samber/lo/pull/485) #### New Contributors - [@&#8203;mihir20](https://togithub.com/mihir20) made their first contribution in [https://github.com/samber/lo/pull/491](https://togithub.com/samber/lo/pull/491) - [@&#8203;ccoVeille](https://togithub.com/ccoVeille) made their first contribution in [https://github.com/samber/lo/pull/480](https://togithub.com/samber/lo/pull/480) - [@&#8203;Sianao](https://togithub.com/Sianao) made their first contribution in [https://github.com/samber/lo/pull/485](https://togithub.com/samber/lo/pull/485) **Full Changelog**: samber/lo@v1.45.0...v1.46.0 ### [`v1.45.0`](https://togithub.com/samber/lo/releases/tag/v1.45.0) [Compare Source](https://togithub.com/samber/lo/compare/v1.44.0...v1.45.0) #### What's Changed - perf: preallocate in Assign by [@&#8203;pmalek](https://togithub.com/pmalek) in [https://github.com/samber/lo/pull/484](https://togithub.com/samber/lo/pull/484) - feat: adding EarliestBy and LatestBy functions by [@&#8203;timych](https://togithub.com/timych) in [https://github.com/samber/lo/pull/489](https://togithub.com/samber/lo/pull/489) #### New Contributors - [@&#8203;pmalek](https://togithub.com/pmalek) made their first contribution in [https://github.com/samber/lo/pull/484](https://togithub.com/samber/lo/pull/484) - [@&#8203;timych](https://togithub.com/timych) made their first contribution in [https://github.com/samber/lo/pull/489](https://togithub.com/samber/lo/pull/489) **Full Changelog**: samber/lo@v1.44.0...v1.45.0
--- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Yang Song
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.

3 participants