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

feat: add WithoutBy #515

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
feat: modify ExampleWithoutBy comments
  • Loading branch information
nicklaus-dev committed Aug 17, 2024
commit fd53232a4b0004439e134bc3d9e432a4c84bfca6
10 changes: 5 additions & 5 deletions intersect_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ func ExampleWithoutBy() {
id int
name string
}
// Example usage
// original users
users := []user{
{id: 1, name: "Alice"},
{id: 2, name: "Bob"},
{id: 3, name: "Charlie"},
}

// Exclude users with IDs 2 and 3
// exclude users with IDs 2 and 3
excludedIDs := []int{2, 3}

// Extract function to get the user ID
// extract function to get the user ID
extractID := func(user user) int {
return user.id
}

// Filtering users
// filtering users
filteredUsers := WithoutBy(users, extractID, excludedIDs...)

// Output the filtered users
// output the filtered users
fmt.Printf("%v\n", filteredUsers)
// Output:
// [{1 Alice}]
Expand Down