Skip to content

content: Consider modifying collections.Where again #3395

@jmooring

Description

@jmooring

To address #3384, in #3386 I modified the description and signature of the collections.Where function from:

Returns the given collection, removing elements that do not satisfy the comparison condition.
collections.Where COLLECTION KEY [OPERATOR] VALUE

To:

Returns a slice by filtering the given slice based on a key, operator, and value.
collections.Where SLICE KEY [OPERATOR] VALUE

But the source code and associated tests indicate that you can use collections.Where with maps as well.

Using it with a slice makes sense, just like a WHERE clause in a SQL query. Using it with a map is, at least to me, counter-intuitive, but perhaps I just haven't come across a real-world example.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions