Skip to content

Feature implementation from commits fdd8865..8755356 #1

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

Open
wants to merge 15 commits into
base: feature-base-1
Choose a base branch
from

Conversation

yashuatla
Copy link
Owner

@yashuatla yashuatla commented Jun 25, 2025

PR Summary

Enhanced Throttling Implementation with Generics

Overview

This PR enhances the throttling functionality by refactoring it to use generics, allowing throttling by arbitrary comparable keys instead of just a simple counter. It also adds documentation and comprehensive test coverage for the new functionality.

Change Types

Type Description
Enhancement Refactored throttle implementation to use generics
Docs Added warning comment about nil pointer dereference in Ternary function
Test Added example functions and tests for new throttling functionality

Affected Modules

Module / File Change Description
condition.go Added documentation comment warning about nil pointer dereference
retry.go Refactored throttle implementation to use generics
retry_example_test.go Added example functions for throttling functionality
retry_test.go Added tests for key-based throttling functionality

Notes for Reviewers

  • The throttle implementation now supports arbitrary comparable keys, which is a significant enhancement to the API
  • Pay attention to the nil pointer dereference warning added to the Ternary function

samber and others added 15 commits January 26, 2025 22:47
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.21.0 to 0.22.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
samber#587)

- Modify the iteration function parameters in the UniqueBy, GroupByMap, and Keyify functions to use index access for collection elements.
- Optimize parameter naming in the GroupByMap function to improve code readability.
- Add test cases for the GroupByMap function to cover different types of inputs.

Co-authored-by: ShuQingZai <[email protected]>
docs: modify mutable example docs
* fix: Issue 605

* Add the Ternary comment from prev commit to function docstring
* feat: Add NthOr and NthOrEmpty functions

This commit introduces two new functions, `NthOr` and `NthOrEmpty`, to the `find` package. These functions provide a safer way to access elements at a specific index in a slice, handling out-of-bounds scenarios gracefully.

- `NthOr`: Returns the element at the specified index or a provided fallback value if the index is out of bounds.
- `NthOrEmpty`: Returns the element at the specified index or the zero value for the slice's element type if the index is out of bounds.

* update readme
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.

9 participants