Skip to content

Q: Querying by count of a slice field #510

@Nitzperetz

Description

@Nitzperetz

Is there an easy way to query by the count of a slice field?

Example:

// ItemA holds a slice of strings
type ItemA struct {
	IDs  []string    `json:"items"`
}

I would like to have the top 10 ItemAs which have the most IDs related to them.
Therefore I would like to sort by the count of IDs field.
Is this scenario possible?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions