mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-03 07:40:28 +08:00
* Adds Generic Set type to `utils`
This patch adds a generic set type to the `utils` package, providing
utility methods and a friendlier syntax for the common Go pattern of
modelling a set of `T` as a `map[T]struct{}`.
While having a common implemntation of set operations like `intersection`
is useful, the main motivation for this change is readability. For example,
declaring a `Set[T]` signals the intent of the author much more clearly
than declaring a `map[T]struct{}`.
* Replace Set.AddAll() with variadic Set.Add()
* Made Remove variadic to match Add()
* Removed obsolete test, added test for Remove()
* Rewrites expression.Set in terms of utils.Set[T] (#47375)
Refactors the Set type in the `expression` package to use `utils.Set[T]` as
the underlying implementations. The `expression.Set` type still exists in
order to implement `expression`-specific interfaces.