testify icon indicating copy to clipboard operation
testify copied to clipboard

Only check specific field value on struct slice? (contains)

Open NinoM4ster opened this issue 1 year ago • 0 comments

I'm trying to check if a struct slice contains a struct which has a specific field value, but I don't want to check the whole struct/all the fields at once.

This is how I'm currently doing it:

image (followers is a struct slice of a User struct which has ID among other fields)

I tried doing this but it didn't work:

image

Is there a better way to do this? I looked through the entire documentation but couldn't find a function that does this.

Thanks!

NinoM4ster avatar Sep 28 '22 17:09 NinoM4ster