jfrog-client-go icon indicating copy to clipboard operation
jfrog-client-go copied to clipboard

Correct way to get if a search returned no results?

Open Roemer opened this issue 2 years ago • 0 comments

What is the correct way to check if a search found items?

Example (simplified):

searchParams := services.SearchParams{ ... }
artifactoryManager, _ := ...
reader, _ := artifactoryManager.SearchFiles(searchParams)
defer reader.Close()
hasResults := ???

I found the reader.IsEmpty method but that actually always returns false, no matter if there are results or not. No idea what the IsEmpty is supposed to do. My current bet is, that I should use reader.Length() and if it is > 0, there are obviously search items. Is this the correct way? Many thanks.

Roemer avatar Feb 09 '23 16:02 Roemer