sif icon indicating copy to clipboard operation
sif copied to clipboard

Add `WithSelectedDescriptors` API

Open tri-adam opened this issue 1 year ago • 0 comments

We currently expose WithDescriptors which iterates across all descriptors, and GetDescriptors which use a selection function to return one or more descriptors.

It occurs to me that there are cases where a caller might want to iterate across only selected descriptors. Although this can be accomplished via WithDescriptors or GetDescriptors today, it requires extra legwork on the part of the caller.

I believe it would be trivial enough to add a new API for this, something like:

func (f *FileImage) WithSelectedDescriptors(fn func(d Descriptor) bool, fns ...DescriptorSelectorFunc)

tri-adam avatar Jul 04 '24 16:07 tri-adam